use of com.iwave.ext.netapp.model.CifsAcl in project coprhd-controller by CoprHD.
the class NetAppFileStorageDevice method createNtpShare.
/**
* create NetApp share with right permissions
*
* @param StorageSystem mount path of the fileshare
* @param args containing input/out arguments of filedevice
* @param smbFileShare smbFileshare object
* @param forceGroup Name of the group the fileshare belongs.
* @return
*/
private Boolean createNtpShare(StorageSystem storage, FileDeviceInputOutput args, SMBFileShare smbFileShare, String forceGroup) throws NetAppException {
String shareId = null;
String portGroup = findVfilerName(args.getFs());
NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).vFiler(portGroup).build();
shareId = smbFileShare.getPath();
_log.info("NetAppFileStorageDevice doShare for {} with id {}", shareId, args.getFileObjId());
if (!nApi.doShare(shareId, smbFileShare.getName(), smbFileShare.getDescription(), smbFileShare.getMaxUsers(), smbFileShare.getPermission(), forceGroup)) {
_log.info("NetAppFileStorageDevice doShare for {} with id {} - failed", shareId, args.getFileObjId());
return false;
} else {
// share creation is successful,no need to set permission,clear the default one.
List<CifsAcl> existingAcls = new ArrayList<CifsAcl>();
CifsAcl defaultAcl = new CifsAcl();
// By default NetApp share get everyone full access.
defaultAcl.setUserName("everyone");
defaultAcl.setAccess(CifsAccess.full);
existingAcls.add(defaultAcl);
nApi.deleteCIFSShareAcl(smbFileShare.getName(), existingAcls);
smbFileShare.setNativeId(shareId);
if (null != args.getFileObj()) {
nApi.setQtreemode(args.getFsPath(), NTFS_QTREE_SETTING);
}
smbFileShare.setNetBIOSName(nApi.getNetBiosName());
_log.info("NetAppFileStorageDevice doShare for {} with id {} - complete", shareId, args.getFileObjId());
return true;
}
}
Aggregations