use of com.emc.storageos.model.file.FileCifsShareACLUpdateParams in project coprhd-controller by CoprHD.
the class SetFileSystemShareACL method doExecute.
@Override
protected Task<FileShareRestRep> doExecute() throws Exception {
FileCifsShareACLUpdateParams aclUpdate = new FileCifsShareACLUpdateParams();
ShareACLs aclsToAdd = FileStorageUtils.createShareACLs(acls);
aclUpdate.setAclsToAdd(aclsToAdd);
return getClient().fileSystems().updateShareACL(fileSystemId, shareName, aclUpdate);
}
use of com.emc.storageos.model.file.FileCifsShareACLUpdateParams in project coprhd-controller by CoprHD.
the class FileSystems method addShareAcl.
/**
* This method called when user Adds an access control entry from UI.
*
* @param aclURL
* URL of the file system share.
* @param shareACL
* This contains the form data from UI.
*/
public static void addShareAcl(String aclURL, ShareACLForm shareACL, String formAccessControlList) {
String fileSystem = null;
String shareName = null;
if (StringUtils.isNotBlank(aclURL)) {
String[] parts = aclURL.split("/");
if (parts.length == 7) {
fileSystem = parts[3];
shareName = parts[5];
}
}
if (formAccessControlList == null || "".equals(formAccessControlList)) {
flash.error(MessagesUtils.get("resources.filesystem.share.acl.invalid.name"), null);
listAcl(fileSystem, shareName);
}
FileCifsShareACLUpdateParams input = createCifsShareAclParams(formAccessControlList);
ViPRCoreClient client = BourneUtil.getViprClient();
try {
client.fileSystems().updateShareACL(uri(fileSystem), shareName, input);
} catch (ServiceErrorException e) {
flash.error(e.getMessage(), null);
listAcl(fileSystem, shareName);
}
flash.success(MessagesUtils.get(ADDED));
listAcl(fileSystem, shareName);
}
use of com.emc.storageos.model.file.FileCifsShareACLUpdateParams in project coprhd-controller by CoprHD.
the class FileSystems method createCifsShareAclParams.
private static FileCifsShareACLUpdateParams createCifsShareAclParams(String formData) {
String[] uiAcls = formData.split(",");
List<ShareACL> acls = new ArrayList<ShareACL>();
for (String uiAce : uiAcls) {
String[] uiData = uiAce.split("~~~");
String uiType = uiData[0];
String uiName = uiData[1];
String uiDomain = uiData[2];
String uiPermission = uiData[3];
ShareACL shareAcl = new ShareACL();
if ("GROUP".equalsIgnoreCase(uiType)) {
shareAcl.setGroup(uiName);
} else {
shareAcl.setUser(uiName);
}
shareAcl.setPermission(uiPermission);
if (uiDomain != null && !"".equals(uiDomain)) {
shareAcl.setDomain(uiDomain);
}
acls.add(shareAcl);
}
FileCifsShareACLUpdateParams input = new FileCifsShareACLUpdateParams();
ShareACLs aclsToAdd = new ShareACLs();
aclsToAdd.setShareACLs(acls);
input.setAclsToAdd(aclsToAdd);
return input;
}
use of com.emc.storageos.model.file.FileCifsShareACLUpdateParams in project coprhd-controller by CoprHD.
the class FileSystems method saveAce.
/**
* This method called When user Modifies ACE.
*
* @param shareACL
* Form Data from modify screen.
*/
@FlashException(referrer = { "fileSystem" })
public static void saveAce(ShareACLForm shareACL) {
String name = params.get("name");
String type = params.get("type");
String domain = params.get("domain");
String shareName = params.get("shareName");
String fileSystemId = params.get("fileSystemId");
String permission = shareACL.permission;
List<ShareACL> ace = new ArrayList<ShareACL>();
ShareACL shareAcl = new ShareACL();
ShareACLs aclsToModify = new ShareACLs();
if ("GROUP".equalsIgnoreCase(type)) {
shareAcl.setGroup(name);
} else {
shareAcl.setUser(name);
}
shareAcl.setPermission(permission);
if (domain != null && !"".equals(domain)) {
shareAcl.setDomain(domain);
}
ace.add(shareAcl);
aclsToModify.setShareACLs(ace);
FileCifsShareACLUpdateParams input = new FileCifsShareACLUpdateParams();
input.setAclsToModify(aclsToModify);
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateShareACL(uri(fileSystemId), shareName, input);
listAcl(fileSystemId, shareName);
}
use of com.emc.storageos.model.file.FileCifsShareACLUpdateParams in project coprhd-controller by CoprHD.
the class FileSystems method removeAcl.
/**
* This method called When user selects ACLs and hit delete button.
*
* @param aclURL
* URL of the file system share.
* @param ids
* ids of the selected ACL
*/
@FlashException(referrer = { "fileSystem" })
public static void removeAcl(String aclUrl, @As(",") String[] ids) {
ShareACLs aclsToDelete = new ShareACLs();
List<ShareACL> shareAcls = new ArrayList<ShareACL>();
String fileSystem = null;
String shareName = null;
if (ids != null && ids.length > 0) {
for (String id : ids) {
String type = ShareACLForm.extractTypeFromId(id);
String name = ShareACLForm.extractNameFromId(id);
String domain = ShareACLForm.extractDomainFromId(id);
fileSystem = ShareACLForm.extractFileSystemFromId(id);
shareName = ShareACLForm.extractShareNameFromId(id);
ShareACL ace = new ShareACL();
if ("Group".equalsIgnoreCase(type)) {
ace.setGroup(name);
} else {
ace.setUser(name);
}
if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
ace.setDomain(domain);
}
shareAcls.add(ace);
}
aclsToDelete.setShareACLs(shareAcls);
FileCifsShareACLUpdateParams input = new FileCifsShareACLUpdateParams();
input.setAclsToDelete(aclsToDelete);
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateShareACL(uri(fileSystem), shareName, input);
}
flash.success(MessagesUtils.get(DELETED));
listAcl(fileSystem, shareName);
}
Aggregations