Search in sources :

Example 6 with CifsAcl

use of com.iwave.ext.netapp.model.CifsAcl in project coprhd-controller by CoprHD.

the class NetAppApi method deleteCIFSShareAcl.

public Boolean deleteCIFSShareAcl(String shareName, List<CifsAcl> acls) throws NetAppException {
    try {
        if (netAppFacade == null) {
            _logger.warn("Invalid Facade found {} creating now...", netAppFacade);
            netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https);
            _logger.warn("Facade created : {} ", netAppFacade);
        }
        for (CifsAcl acl : acls) {
            acl.setShareName(shareName);
            netAppFacade.deleteCIFSAcl(acl);
        }
    } catch (Exception e) {
        _logger.error("Error Occured {} ", e.getMessage(), e);
        throw NetAppException.exceptions.deleteCIFSShareAclFailed(shareName, e.getMessage());
    }
    return true;
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) CifsAcl(com.iwave.ext.netapp.model.CifsAcl)

Example 7 with CifsAcl

use of com.iwave.ext.netapp.model.CifsAcl in project coprhd-controller by CoprHD.

the class NetAppApi method listCIFSShareAcl.

public List<CifsAcl> listCIFSShareAcl(String ShareName) throws NetAppException {
    try {
        if (netAppFacade == null) {
            _logger.warn("Invalid Facade found {} creating now...", netAppFacade);
            netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https);
            _logger.warn("Facade created : {} ", netAppFacade);
        }
        List<CifsAcl> oldacls = netAppFacade.listCIFSAcls(ShareName);
        return oldacls;
    } catch (Exception e) {
        _logger.error("Error Occured {} ", e.getMessage(), e);
        throw NetAppException.exceptions.listCIFSShareAclFailed(ShareName, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) CifsAcl(com.iwave.ext.netapp.model.CifsAcl)

Example 8 with CifsAcl

use of com.iwave.ext.netapp.model.CifsAcl in project coprhd-controller by CoprHD.

the class NetAppApi method modifyShare.

public Boolean modifyShare(String mntpath, String shareName, String comment, int maxusers, String permission, String forcegroup) throws NetAppException {
    try {
        netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https, _vFilerName);
        CifsAcl acl = new CifsAcl();
        acl.setShareName(shareName);
        acl.setAccess(CifsAccess.valueOfAccess(cifsPermissionMap.get(permission)));
        acl.setUserName(CIFS_DEFAULT_GROUP);
        netAppFacade.setCIFSAcl(acl);
        return true;
    } catch (Exception e) {
        throw NetAppException.exceptions.modifyShareFailed(_ipAddress, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) CifsAcl(com.iwave.ext.netapp.model.CifsAcl)

Example 9 with CifsAcl

use of com.iwave.ext.netapp.model.CifsAcl in project coprhd-controller by CoprHD.

the class NetAppApi method modifyCIFSShareAcl.

public Boolean modifyCIFSShareAcl(String shareName, List<CifsAcl> acls) throws NetAppException {
    try {
        if (netAppFacade == null) {
            _logger.warn("Invalid Facade found {} creating now...", netAppFacade);
            netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https);
            _logger.warn("Facade created : {} ", netAppFacade);
        }
        for (CifsAcl acl : acls) {
            acl.setShareName(shareName);
            netAppFacade.setCIFSAcl(acl);
        }
    } catch (Exception e) {
        _logger.error("Error Occured {} ", e.getMessage(), e);
        throw NetAppException.exceptions.modifyCifsShareAclFailed(shareName, e.getMessage());
    }
    return true;
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) CifsAcl(com.iwave.ext.netapp.model.CifsAcl)

Example 10 with CifsAcl

use of com.iwave.ext.netapp.model.CifsAcl in project coprhd-controller by CoprHD.

the class NetAppFileStorageDevice method forceAddShareAcl.

private void forceAddShareAcl(NetAppApi nApi, String shareName, List<ShareACL> aclsToAdd) {
    if (aclsToAdd == null || aclsToAdd.isEmpty()) {
        return;
    }
    List<CifsAcl> acls = new ArrayList<CifsAcl>();
    for (ShareACL newAcl : aclsToAdd) {
        CifsAcl cif_new = new CifsAcl();
        String domain = newAcl.getDomain();
        String userOrGroup = newAcl.getGroup() == null ? newAcl.getUser() : newAcl.getGroup();
        if (domain != null && !domain.isEmpty()) {
            userOrGroup = domain + "\\" + userOrGroup;
        }
        // for netapp api user and group are same.and need to set only user
        cif_new.setUserName(userOrGroup);
        cif_new.setShareName(shareName);
        cif_new.setAccess(getAccessEnum(newAcl.getPermission()));
        acls.add(cif_new);
    }
    for (CifsAcl cifsAcl : acls) {
        try {
            List<CifsAcl> singleACL = new ArrayList<CifsAcl>();
            singleACL.add(cifsAcl);
            nApi.modifyCIFSShareAcl(shareName, singleACL);
        } catch (Exception e) {
            _log.error("NetAppFileStorageDevice:: Force add of ACL for user [" + cifsAcl.getUserName() + "] failed with an Exception", e);
        }
    }
}
Also used : CifsAcl(com.iwave.ext.netapp.model.CifsAcl) ArrayList(java.util.ArrayList) ShareACL(com.emc.storageos.model.file.ShareACL) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) NetAppException(com.emc.storageos.netapp.NetAppException)

Aggregations

CifsAcl (com.iwave.ext.netapp.model.CifsAcl)11 ArrayList (java.util.ArrayList)7 ShareACL (com.emc.storageos.model.file.ShareACL)4 NetAppFacade (com.iwave.ext.netapp.NetAppFacade)4 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 NetAppException (com.emc.storageos.netapp.NetAppException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 UnManagedCifsShareACL (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedCifsShareACL)1 UnManagedSMBFileShare (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare)1 NetAppApi (com.emc.storageos.netapp.NetAppApi)1 NaAPIFailedException (netapp.manage.NaAPIFailedException)1 NaElement (netapp.manage.NaElement)1