List of usage examples for org.springframework.security.acls.model MutableAcl getParentAcl
Acl getParentAcl();
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()); }// www .jav 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()); }
From source file:com.kylinolap.rest.service.AclService.java
@Override public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException { try {/*from w w w . j ava 2 s . c o m*/ readAclById(acl.getObjectIdentity()); } catch (NotFoundException e) { throw e; } HTableInterface htable = null; try { htable = HBaseConnection.get(hbaseUrl).getTable(aclTableName); Delete delete = new Delete(Bytes.toBytes(String.valueOf(acl.getObjectIdentity().getIdentifier()))); delete.deleteFamily(Bytes.toBytes(ACL_ACES_FAMILY)); htable.delete(delete); Put put = new Put(Bytes.toBytes(String.valueOf(acl.getObjectIdentity().getIdentifier()))); if (null != acl.getParentAcl()) { put.add(Bytes.toBytes(ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN), domainObjSerializer .serialize(new DomainObjectInfo(acl.getParentAcl().getObjectIdentity()))); } for (AccessControlEntry ace : acl.getEntries()) { AceInfo aceInfo = new AceInfo(ace); put.add(Bytes.toBytes(ACL_ACES_FAMILY), Bytes.toBytes(aceInfo.getSidInfo().getSid()), aceSerializer.serialize(aceInfo)); } if (!put.isEmpty()) { htable.put(put); htable.flushCommits(); logger.debug("ACL of " + acl.getObjectIdentity() + " updated successfully."); } } catch (IOException e) { logger.error(e.getLocalizedMessage(), e); } finally { IOUtils.closeQuietly(htable); } return (MutableAcl) readAclById(acl.getObjectIdentity()); }
From source file:org.apache.kylin.rest.service.AclService.java
@Override public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException { try {/*from w w w. j a va 2s . c o m*/ readAclById(acl.getObjectIdentity()); } catch (NotFoundException e) { throw e; } HTableInterface htable = null; try { htable = aclHBaseStorage.getTable(aclTableName); Delete delete = new Delete(Bytes.toBytes(String.valueOf(acl.getObjectIdentity().getIdentifier()))); delete.deleteFamily(Bytes.toBytes(AclHBaseStorage.ACL_ACES_FAMILY)); htable.delete(delete); Put put = new Put(Bytes.toBytes(String.valueOf(acl.getObjectIdentity().getIdentifier()))); if (null != acl.getParentAcl()) { put.add(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN), domainObjSerializer .serialize(new DomainObjectInfo(acl.getParentAcl().getObjectIdentity()))); } for (AccessControlEntry ace : acl.getEntries()) { AceInfo aceInfo = new AceInfo(ace); put.add(Bytes.toBytes(AclHBaseStorage.ACL_ACES_FAMILY), Bytes.toBytes(aceInfo.getSidInfo().getSid()), aceSerializer.serialize(aceInfo)); } if (!put.isEmpty()) { htable.put(put); htable.flushCommits(); logger.debug("ACL of " + acl.getObjectIdentity() + " updated successfully."); } } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { IOUtils.closeQuietly(htable); } return (MutableAcl) readAclById(acl.getObjectIdentity()); }
From source file:org.apache.kylin.rest.service.LegacyAclService.java
@Override public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException { try {//w w w . j a v a 2 s . c o m readAclById(acl.getObjectIdentity()); } catch (NotFoundException e) { throw e; } Table htable = null; try { htable = aclHBaseStorage.getTable(aclTableName); Delete delete = new Delete(Bytes.toBytes(String.valueOf(acl.getObjectIdentity().getIdentifier()))); delete.deleteFamily(Bytes.toBytes(AclHBaseStorage.ACL_ACES_FAMILY)); htable.delete(delete); Put put = new Put(Bytes.toBytes(String.valueOf(acl.getObjectIdentity().getIdentifier()))); if (null != acl.getParentAcl()) { put.addColumn(Bytes.toBytes(AclHBaseStorage.ACL_INFO_FAMILY), Bytes.toBytes(ACL_INFO_FAMILY_PARENT_COLUMN), domainObjSerializer .serialize(new DomainObjectInfo(acl.getParentAcl().getObjectIdentity()))); } for (AccessControlEntry ace : acl.getEntries()) { AceInfo aceInfo = new AceInfo(ace); put.addColumn(Bytes.toBytes(AclHBaseStorage.ACL_ACES_FAMILY), Bytes.toBytes(aceInfo.getSidInfo().getSid()), aceSerializer.serialize(aceInfo)); } if (!put.isEmpty()) { htable.put(put); logger.debug("ACL of " + acl.getObjectIdentity() + " updated successfully."); } } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { IOUtils.closeQuietly(htable); } return (MutableAcl) readAclById(acl.getObjectIdentity()); }
From source file:ubic.gemma.security.authorization.acl.AclAdvice.java
/** * This is used when rechecking objects that are detached from a parent. Typically these are {@link SecuredChild}ren * like BioAssays./*from w w w .ja v a 2 s .c o m*/ * <p> * Be careful with the argument order! * * @param object * @param acl - the potential child * @param parentAcl - the potential parent * @return the parentAcl (can be null) */ private Acl maybeSetParentACL(final Securable object, MutableAcl childAcl, final Acl parentAcl) { if (parentAcl != null && !SecuredNotChild.class.isAssignableFrom(object.getClass())) { Acl currentParentAcl = childAcl.getParentAcl(); if (currentParentAcl != null && !currentParentAcl.equals(parentAcl)) { throw new IllegalStateException("Cannot change parentAcl once it has ben set: Current parent: " + currentParentAcl + " != Proposed parent:" + parentAcl); } boolean changedParentAcl = false; if (currentParentAcl == null) { childAcl.setParent(parentAcl); childAcl.setEntriesInheriting(true); changedParentAcl = true; } boolean clearedACEs = maybeClearACEsOnChild(object, childAcl, parentAcl); if (changedParentAcl || clearedACEs) { aclService.updateAcl(childAcl); } } return childAcl.getParentAcl(); }