use of com.emc.storageos.db.client.model.DataObjectWithACLs in project coprhd-controller by CoprHD.
the class TenantsService method clearTenantACLs.
/**
* Clear any tenant USE ACLs associated with the provided tenant id from the indicated CF
*
* @param clazz CF type to clear of tenant ACLs
* @param tenantId the tenant id
* @param specifier optional specifier (e.g. block or file for VirtualPools)
*/
private void clearTenantACLs(Class<? extends DataObjectWithACLs> clazz, URI tenantId, String specifier) {
PermissionsKey permissionKey;
if (StringUtils.isNotBlank(specifier)) {
permissionKey = new PermissionsKey(PermissionsKey.Type.TENANT, tenantId.toString(), specifier);
} else {
permissionKey = new PermissionsKey(PermissionsKey.Type.TENANT, tenantId.toString());
}
URIQueryResultList resultURIs = new URIQueryResultList();
Constraint aclConstraint = ContainmentPermissionsConstraint.Factory.getObjsWithPermissionsConstraint(permissionKey.toString(), clazz);
_dbClient.queryByConstraint(aclConstraint, resultURIs);
List<URI> ids = new ArrayList<URI>();
for (URI result : resultURIs) {
ids.add(result);
}
Iterator<? extends DataObjectWithACLs> objectIter = _dbClient.queryIterativeObjects(clazz, ids);
if ((objectIter != null) && (objectIter.hasNext())) {
List<DataObjectWithACLs> objectList = new ArrayList<DataObjectWithACLs>();
while (objectIter.hasNext()) {
objectList.add(objectIter.next());
}
for (DataObjectWithACLs object : objectList) {
_log.info("Removing USE ACL for deleted subtenant {} from object {}", tenantId, object.getId());
object.removeAcl(permissionKey.toString(), ACL.USE.toString());
}
_dbClient.updateAndReindexObject(objectList);
}
}
Aggregations