use of com.emc.storageos.model.file.NfsACE 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));
}
use of com.emc.storageos.model.file.NfsACE in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method updateSidInfoForNfsACE.
private void updateSidInfoForNfsACE(FileDeviceInputOutput args, StorageSystem storage) {
IsilonApi isi = getIsilonDevice(storage);
List<NfsACE> list = new ArrayList<NfsACE>();
list.addAll(args.getNfsAclsToAdd());
list.addAll(args.getNfsAclsToModify());
list.addAll(args.getNfsAclsToDelete());
for (NfsACE nfsACE : list) {
String id = getIdForDomainUserOrGroup(isi, args.getvNAS(), nfsACE.getDomain(), nfsACE.getUser(), nfsACE.getType(), true);
if (!id.isEmpty()) {
nfsACE.setSid(id);
}
}
}
use of com.emc.storageos.model.file.NfsACE in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method deleteNfsACLs.
@Override
public BiosCommandResult deleteNfsACLs(StorageSystem storage, FileDeviceInputOutput args) {
IsilonNFSACL isilonAcl = new IsilonNFSACL();
ArrayList<Acl> aclCompleteList = new ArrayList<Acl>();
List<NfsACE> aceToDelete = args.getNfsAclsToDelete();
for (NfsACE nfsACE : aceToDelete) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("delete");
aclCompleteList.add(acl);
}
isilonAcl.setAction("update");
isilonAcl.setAuthoritative("acl");
isilonAcl.setAcl(aclCompleteList);
String path = args.getFileSystemPath();
if (args.getSubDirectory() != null && !args.getSubDirectory().isEmpty()) {
path = path + "/" + args.getSubDirectory();
}
// Process new ACLs
IsilonApi isi = getIsilonDevice(storage);
_log.info("Calling Isilon API: to delete NFS Acl for {}, acl {}", args.getFileSystemPath(), isilonAcl);
isi.modifyNFSACL(path, isilonAcl);
_log.info("End deleteNfsACLs");
BiosCommandResult result = BiosCommandResult.createSuccessfulResult();
return result;
}
use of com.emc.storageos.model.file.NfsACE in project coprhd-controller by CoprHD.
the class FileOrchestrationUtils method convertNFSShareACLToNfsACE.
public static NfsACE convertNFSShareACLToNfsACE(NFSShareACL dbNFSAcl) {
NfsACE dest = new NfsACE();
dest.setDomain(dbNFSAcl.getDomain());
dest.setPermissions(dbNFSAcl.getPermissions());
dest.setPermissionType(FileControllerConstants.NFS_FILE_PERMISSION_TYPE_ALLOW);
if (dbNFSAcl.getPermissionType() != null && !dbNFSAcl.getPermissionType().isEmpty()) {
dest.setPermissionType(dbNFSAcl.getPermissionType());
}
dest.setType("user");
if (dbNFSAcl.getType() != null && !dbNFSAcl.getType().isEmpty()) {
dest.setType(dbNFSAcl.getType());
}
dest.setUser(dbNFSAcl.getUser());
return dest;
}
use of com.emc.storageos.model.file.NfsACE in project coprhd-controller by CoprHD.
the class FileOrchestrationUtils method queryNFSACL.
public static Map<String, List<NfsACE>> queryNFSACL(FileShare fs, DbClient dbClient) {
Map<String, List<NfsACE>> map = new HashMap<String, List<NfsACE>>();
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileNfsAclsConstraint(fs.getId());
List<NFSShareACL> nfsAclList = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, NFSShareACL.class, containmentConstraint);
if (nfsAclList != null) {
Iterator<NFSShareACL> aclIter = nfsAclList.iterator();
while (aclIter.hasNext()) {
NFSShareACL dbNFSAcl = aclIter.next();
String fsPath = dbNFSAcl.getFileSystemPath();
NfsACE ace = convertNFSShareACLToNfsACE(dbNFSAcl);
if (map.get(fsPath) == null) {
List<NfsACE> acl = new ArrayList<NfsACE>();
acl.add(ace);
map.put(fsPath, acl);
} else {
map.get(fsPath).add(ace);
}
}
}
return map;
}
Aggregations