Search in sources :

Example 6 with FileNfsACLUpdateParams

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);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileNfsACLUpdateParams(com.emc.storageos.model.file.FileNfsACLUpdateParams) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException) FlashException(controllers.util.FlashException) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException)

Example 7 with FileNfsACLUpdateParams

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);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NfsACE(com.emc.storageos.model.file.NfsACE) FileNfsACLUpdateParams(com.emc.storageos.model.file.FileNfsACLUpdateParams) FlashException(controllers.util.FlashException)

Aggregations

FileNfsACLUpdateParams (com.emc.storageos.model.file.FileNfsACLUpdateParams)7 NfsACE (com.emc.storageos.model.file.NfsACE)4 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 FlashException (controllers.util.FlashException)4 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)2 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)2 FileShare (com.emc.storageos.db.client.model.FileShare)1 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1 FileWorkflowCompleter (com.emc.storageos.volumecontroller.impl.file.FileWorkflowCompleter)1 Workflow (com.emc.storageos.workflow.Workflow)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1