Example usage for org.springframework.security.acls.model MutableAcl getId

List of usage examples for org.springframework.security.acls.model MutableAcl getId

Introduction

In this page you can find the example usage for org.springframework.security.acls.model MutableAcl getId.

Prototype

Serializable getId();

Source Link

Document

Obtains an identifier that represents this MutableAcl.

Usage

From source file:com.cedac.security.acls.mongo.MongoMutableAclService.java

@Override
public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException {
    Assert.notNull(acl.getId(), "Object Identity doesn't provide an identifier");

    DBObject persistedAcl = getAclCollection().findOne(queryByObjectIdentity(acl.getObjectIdentity()));

    if (persistedAcl == null) {
        LOG.trace(ACL, "No ACL found for object identity {}", acl.getObjectIdentity());

        throw new NotFoundException("No acl found for object identity " + acl.getObjectIdentity());
    }//  w ww.  j a va  2  s .c  o  m

    LOG.debug(ACL, "Updating persisted ACL object");

    if (acl.getParentAcl() != null) {
        ObjectIdentity parentOid = acl.getParentAcl().getObjectIdentity();
        persistedAcl.put(parentObjectFieldName, toDBObject(parentOid));
    }

    persistedAcl.put(ownerFieldName, toDBObject(acl.getOwner()));
    persistedAcl.put(entriesInheritingFieldName, acl.isEntriesInheriting());

    BasicDBList list = new BasicDBList();
    for (AccessControlEntry entry : acl.getEntries()) {
        list.add(toDBObject(entry));
    }
    persistedAcl.put(entriesFieldName, list);

    getAclCollection().save(persistedAcl, writeConcern);

    LOG.trace(ACL, "Clearing cache including children for object identity {}", acl.getObjectIdentity());

    clearCacheIncludingChildren(acl.getObjectIdentity());

    LOG.trace(ACL, "Retrieve ACL via superclass.");

    return (MutableAcl) super.readAclById(acl.getObjectIdentity());
}