Search in sources :

Example 1 with NfsACLDataTable

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);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NfsACLDataTable(models.datatable.NfsACLDataTable) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 2 with NfsACLDataTable

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));
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NfsACL(com.emc.storageos.model.file.NfsACL) NfsACE(com.emc.storageos.model.file.NfsACE) NfsACLDataTable(models.datatable.NfsACLDataTable)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 NfsACLDataTable (models.datatable.NfsACLDataTable)2 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)1 NfsACE (com.emc.storageos.model.file.NfsACE)1 NfsACL (com.emc.storageos.model.file.NfsACL)1