use of com.emc.storageos.model.file.FileNfsACLUpdateParams in project coprhd-controller by CoprHD.
the class FileSystems method addNfsAcl.
public static void addNfsAcl(String fileSystemSubDirAndPath, ShareACLForm shareACL, String formAccessControlList) {
String fileSystem = null;
String subDir = null;
String fsMountPath = null;
if (StringUtils.isNotBlank(fileSystemSubDirAndPath)) {
String[] parts = fileSystemSubDirAndPath.split("~~~");
if (parts.length == 3) {
fileSystem = parts[0];
subDir = parts[1];
fsMountPath = parts[2];
}
}
if (formAccessControlList == null || "".equals(formAccessControlList)) {
flash.error(MessagesUtils.get("resources.filesystem.share.acl.invalid.settings"), null);
listNfsAcl(fileSystem, fsMountPath, subDir);
}
FileNfsACLUpdateParams input = createNfsAclParams(formAccessControlList);
if (subDir != null && !"null".equals(subDir) && !subDir.isEmpty()) {
input.setSubDir(subDir);
}
ViPRCoreClient client = BourneUtil.getViprClient();
try {
client.fileSystems().updateNfsACL(uri(fileSystem), input);
} catch (Exception e) {
flash.error(e.getMessage(), null);
listNfsAcl(fileSystem, fsMountPath, subDir);
}
flash.success(MessagesUtils.get(ADDED));
listNfsAcl(fileSystem, fsMountPath, subDir);
}
use of com.emc.storageos.model.file.FileNfsACLUpdateParams in project coprhd-controller by CoprHD.
the class FileSystems method removeNfsAcl.
@FlashException(referrer = { "fileSystem" })
public static void removeNfsAcl(@As(",") String[] ids) {
List<NfsACE> aces = Lists.newArrayList();
String fileSystem = null;
String subDir = null;
String fsMountPath = null;
if (ids != null && ids.length > 0) {
for (String id : ids) {
String type = NfsACLForm.extractTypeFromId(id);
String name = NfsACLForm.extractNameFromId(id);
String domain = NfsACLForm.extractDomainFromId(id);
String permissions = NfsACLForm.extractPermissionsFromId(id);
String permissionType = NfsACLForm.extractPermissionTypeFromId(id);
fileSystem = NfsACLForm.extractFileSystemFromId(id);
subDir = NfsACLForm.extractSubDirFromId(id);
fsMountPath = NfsACLForm.extractMounPathFromId(id);
NfsACE ace = new NfsACE();
ace.setUser(name);
ace.setType(type);
ace.setPermissions(permissions.replaceAll("/", ","));
ace.setPermissionType(permissionType);
if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
ace.setDomain(domain);
}
aces.add(ace);
}
FileNfsACLUpdateParams input = new FileNfsACLUpdateParams();
input.setAcesToDelete(aces);
if (subDir != null && !"null".equals(subDir)) {
input.setSubDir(subDir);
}
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateNfsACL(uri(fileSystem), input);
}
flash.success(MessagesUtils.get(DELETED));
listNfsAcl(fileSystem, fsMountPath, subDir);
}
Aggregations