use of models.datatable.NfsACLDataTable in project coprhd-controller by CoprHD.
the class FileSystems method listNfsAcl.
public static void listNfsAcl(String fileSystemId, String fsMountPath, String subDir) {
renderArgs.put("dataTable", new NfsACLDataTable());
renderArgs.put("subDir", subDir);
renderArgs.put("fileSystemId", uri(fileSystemId));
renderArgs.put("fsMountPath", fsMountPath);
renderArgs.put("fileSystemSubDirAndPath", fileSystemId + "~~~" + subDir + "~~~" + fsMountPath);
renderArgs.put("permissionOptions", StringOption.options(new String[] { "read", "write", "execute", "fullControl" }));
ViPRCoreClient client = BourneUtil.getViprClient();
NfsACLForm nfsACL = new NfsACLForm();
FileShareRestRep restRep = client.fileSystems().get(uri(fileSystemId));
renderArgs.put("fileSystemName", restRep.getName());
render(nfsACL);
}
use of models.datatable.NfsACLDataTable in project coprhd-controller by CoprHD.
the class FileSystems method listNfsAclJson.
public static void listNfsAclJson(String fileSystemSubDirAndPath) {
renderArgs.put("dataTable", new NfsACLDataTable());
String fileSystemId = null;
String subDir = null;
String fsMountPath = null;
if (StringUtils.isNotBlank(fileSystemSubDirAndPath)) {
String[] parts = fileSystemSubDirAndPath.split("~~~");
if (parts.length == 3) {
fileSystemId = parts[0];
subDir = parts[1];
fsMountPath = parts[2];
}
}
renderArgs.put("subDir", subDir);
renderArgs.put("fsMountPath", fsMountPath);
renderArgs.put("fileSystemId", uri(fileSystemId));
renderArgs.put("fileSystemName", uri(fileSystemId));
ViPRCoreClient client = BourneUtil.getViprClient();
List<NfsACL> nfsAcls = client.fileSystems().getNfsACLs(uri(fileSystemId), subDir);
NfsACL nfsAcl = new NfsACL();
List<NfsACLDataTable.NfsAclInfo> nfsAccessControlList = Lists.newArrayList();
if (nfsAcls.size() > 0) {
nfsAcl = nfsAcls.get(0);
List<NfsACE> acl = nfsAcl.getNfsAces();
for (NfsACE ace : acl) {
String name = ace.getUser();
String type = ace.getType();
String permissions = ace.getPermissions();
String domain = ace.getDomain();
String permissionType = ace.getPermissionType();
nfsAccessControlList.add(new NfsACLDataTable.NfsAclInfo(name, type, permissions, fileSystemId, subDir, domain, fsMountPath, permissionType));
}
}
renderJSON(DataTablesSupport.createJSON(nfsAccessControlList, params));
}
Aggregations