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

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

Introduction

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

Prototype

boolean isEntriesInheriting();

Source Link

Document

Indicates whether the ACL entries from the #getParentAcl() should flow down into the current Acl.

Usage

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

@Test
@ShouldMatchDataSet//from   w w  w.  j  a  v a2 s.c o m
public void creatingAcl_withNoAcl() {
    MutableAcl acl = fixture
            .createAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "2"));

    assertNotNull(acl);
    assertEquals("com.cedac.smartresidence.profile.domain.Home", acl.getObjectIdentity().getType());
    assertEquals("2", acl.getObjectIdentity().getIdentifier());
    assertEquals(new PrincipalSid("admin@cedac.com"), acl.getOwner());
    assertEquals(true, acl.isEntriesInheriting());
    assertEquals(0, acl.getEntries().size());
}

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 w  w.ja  v  a 2 s. co  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());
}