use of com.emc.storageos.db.client.model.CifsShareACL in project coprhd-controller by CoprHD.
the class CifsShareUtility method verifyAddShareACLs.
private void verifyAddShareACLs(List<ShareACL> shareAclList) {
if (shareAclList == null) {
return;
}
_log.info("Number of share ACL(s) to add {} ", shareAclList.size());
for (ShareACL acl : shareAclList) {
acl.proceedToNextStep();
_log.info("Verifying ACL {}", acl.toString());
// Are there same user or group found in other acls. If so, report
// error
verifyUserGroup(acl);
if (!acl.canProceedToNextStep()) {
break;
}
validatePermissions(acl);
if (!acl.canProceedToNextStep()) {
break;
}
// Verify with existing ACL
CifsShareACL dbShareAcl = getExistingACL(acl);
// If same acl exists, don't allow to add again.
if (dbShareAcl != null) {
_log.error("Duplicate ACL in add request. User/group in ACL for share already exists: {}", dbShareAcl);
acl.cancelNextStep(ShareACLOperationErrorType.ACL_EXISTS);
break;
} else // If not found proceed for further verifications.
{
if (acl.canProceedToNextStep()) {
_log.info("No existing ACL found in DB {}", acl);
}
}
}
}
use of com.emc.storageos.db.client.model.CifsShareACL in project coprhd-controller by CoprHD.
the class CifsShareUtility method verifyDeleteShareACLs.
private void verifyDeleteShareACLs(List<ShareACL> shareAclList) {
if (shareAclList == null) {
return;
}
_log.info("Number of share ACL(s) to delete {} ", shareAclList.size());
for (ShareACL acl : shareAclList) {
acl.proceedToNextStep();
_log.info("Verifying ACL {}", acl.toString());
// Are there same user or group found in other acls. If so, report
// error
verifyUserGroup(acl);
if (!acl.canProceedToNextStep()) {
break;
}
// Verify with existing ACL
CifsShareACL dbShareAcl = getExistingACL(acl);
// If same acl exists, allow to modify
if (dbShareAcl != null) {
_log.info("Existing ACL found in delete request: {}", dbShareAcl);
acl.proceedToNextStep();
} else {
// If not found, don't allow to proceed further
if (acl.canProceedToNextStep()) {
_log.error("No existing ACL found in DB to delete {}", acl);
acl.cancelNextStep(ShareACLOperationErrorType.ACL_NOT_FOUND);
}
}
}
}
use of com.emc.storageos.db.client.model.CifsShareACL in project coprhd-controller by CoprHD.
the class CifsShareUtility method verifyModifyShareACLs.
private void verifyModifyShareACLs(List<ShareACL> shareAclList) {
if (shareAclList == null) {
return;
}
_log.info("Number of share ACL(s) to modify {} ", shareAclList.size());
for (ShareACL acl : shareAclList) {
acl.proceedToNextStep();
_log.info("Verifying ACL {}", acl.toString());
// Are there same user or group found in other acls. If so, report
// error
verifyUserGroup(acl);
if (!acl.canProceedToNextStep()) {
break;
}
validatePermissions(acl);
if (!acl.canProceedToNextStep()) {
break;
}
// Verify with existing ACL
CifsShareACL dbShareAcl = getExistingACL(acl);
// If same acl exists, allow to modify
if (dbShareAcl != null) {
_log.info("Existing ACL in modify request: {}", dbShareAcl);
acl.proceedToNextStep();
} else {
// If not found, don't allow to proceed further
if (acl.canProceedToNextStep()) {
_log.error("No existing ACL found in DB to modify {}", acl);
acl.cancelNextStep(ShareACLOperationErrorType.ACL_NOT_FOUND);
}
}
}
}
use of com.emc.storageos.db.client.model.CifsShareACL in project coprhd-controller by CoprHD.
the class FileDeviceController method getExistingShareAclFromDB.
private CifsShareACL getExistingShareAclFromDB(CifsShareACL dbShareAcl, FileDeviceInputOutput args) {
CifsShareACL acl = null;
String index = null;
URIQueryResultList result = new URIQueryResultList();
if (args.getFileOperation()) {
index = dbShareAcl.getFileSystemShareACLIndex();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getFileSystemShareACLConstraint(index), result);
} else {
index = dbShareAcl.getSnapshotShareACLIndex();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getSnapshotShareACLConstraint(index), result);
}
Iterator<URI> it = result.iterator();
while (it.hasNext()) {
if (result.iterator().hasNext()) {
acl = _dbClient.queryObject(CifsShareACL.class, it.next());
if (acl != null && !acl.getInactive()) {
_log.info("Existing ACE found in DB: {}", acl);
return acl;
}
}
}
return null;
}
use of com.emc.storageos.db.client.model.CifsShareACL in project coprhd-controller by CoprHD.
the class FileDeviceController method queryExistingShareAcls.
private List<ShareACL> queryExistingShareAcls(FileDeviceInputOutput args) {
_log.info("Querying for Share ACLs of share {}", args.getShareName());
List<ShareACL> acls = new ArrayList<ShareACL>();
try {
List<CifsShareACL> dbShareAclList = queryDBShareAcls(args);
Iterator<CifsShareACL> dbShareAclIter = dbShareAclList.iterator();
while (dbShareAclIter.hasNext()) {
CifsShareACL dbShareAcl = dbShareAclIter.next();
ShareACL shareAcl = new ShareACL();
shareAcl.setDomain(dbShareAcl.getDomain());
if (args.getFileOperation()) {
shareAcl.setFileSystemId(dbShareAcl.getFileSystemId());
} else {
shareAcl.setSnapshotId(dbShareAcl.getSnapshotId());
}
shareAcl.setGroup(dbShareAcl.getGroup());
shareAcl.setPermission(dbShareAcl.getPermission());
shareAcl.setShareName(dbShareAcl.getShareName());
shareAcl.setUser(dbShareAcl.getUser());
acls.add(shareAcl);
}
} catch (Exception e) {
_log.error("Error while querying ACL(s) of a share {}", e);
}
return acls;
}
Aggregations