use of com.emc.storageos.db.client.model.ObjectBucketACL in project coprhd-controller by CoprHD.
the class BucketACLUtility method verifyModifyBucketACL.
private void verifyModifyBucketACL(List<BucketACE> bucketACEList) {
if (bucketACEList == null) {
return;
}
_log.info("Number of bucket ACE(s) to modify {} ", bucketACEList.size());
for (BucketACE ace : bucketACEList) {
ace.proceedToNextStep();
_log.info("Verifying ACL {}", ace.toString());
// Are there same user or group found in other acls. If so, report
// error
verifyUserGroupCustomgroup(ace);
if (!ace.canProceedToNextStep()) {
break;
}
validatePermissions(ace);
if (!ace.canProceedToNextStep()) {
break;
}
// Verify with existing ACL
ObjectBucketACL dbBucketAcl = getExistingACL(ace);
// If same acl exists, allow to modify
if (dbBucketAcl != null) {
_log.info("Existing ACL in modify request: {}", dbBucketAcl);
ace.proceedToNextStep();
} else {
// If not found, don't allow to proceed further
if (ace.canProceedToNextStep()) {
_log.error("No existing ACL found in DB to modify {}", ace);
ace.cancelNextStep(BucketACLOperationErrorType.ACL_NOT_FOUND);
}
}
}
}
use of com.emc.storageos.db.client.model.ObjectBucketACL in project coprhd-controller by CoprHD.
the class ObjectDeviceController method queryDbBucketAcl.
private List<ObjectBucketACL> queryDbBucketAcl(ObjectDeviceInputOutput args, URI bucketId) {
List<ObjectBucketACL> acls = new ArrayList<ObjectBucketACL>();
try {
ContainmentConstraint containmentConstraint = null;
_log.info("Querying DB for ACL of Bucket {} ", args.getName());
containmentConstraint = ContainmentConstraint.Factory.getBucketAclsConstraint(bucketId);
List<ObjectBucketACL> bucketAclList = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, ObjectBucketACL.class, containmentConstraint);
Iterator<ObjectBucketACL> bucketAclIter = bucketAclList.iterator();
while (bucketAclIter.hasNext()) {
ObjectBucketACL bucketAce = bucketAclIter.next();
if (args.getName().equals(bucketAce.getBucketName())) {
acls.add(bucketAce);
}
}
} catch (Exception e) {
_log.error("Error while querying DB for ACL(s) of a share {}", e);
}
return acls;
}
use of com.emc.storageos.db.client.model.ObjectBucketACL in project coprhd-controller by CoprHD.
the class ObjectDeviceController method queryExistingBucketAcl.
private List<BucketACE> queryExistingBucketAcl(ObjectDeviceInputOutput args, URI buckeId) {
_log.info("Querying ACL of Bucket {}", args.getName());
List<BucketACE> acl = new ArrayList<BucketACE>();
try {
List<ObjectBucketACL> dbBucketAclList = queryDbBucketAcl(args, buckeId);
Iterator<ObjectBucketACL> dbAclIter = dbBucketAclList.iterator();
while (dbAclIter.hasNext()) {
ObjectBucketACL dbBucketAcl = dbAclIter.next();
BucketACE ace = new BucketACE();
ace.setDomain(dbBucketAcl.getDomain());
ace.setBucketName(dbBucketAcl.getBucketName());
ace.setGroup(dbBucketAcl.getGroup());
ace.setPermissions(dbBucketAcl.getPermissions());
ace.setNamespace(dbBucketAcl.getNamespace());
ace.setUser(dbBucketAcl.getUser());
ace.setCustomGroup(dbBucketAcl.getCustomGroup());
acl.add(ace);
}
} catch (Exception e) {
_log.error("Error while querying ACL(s) of a share {}", e);
}
return acl;
}
Aggregations