use of com.emc.metalnx.core.domain.entity.DataGridGroup in project metalnx-web by irods-contrib.
the class GroupBookmarkController method addBookmarkToGroup.
@RequestMapping(value = "/addBookmarkToGroup/")
@ResponseBody
public String addBookmarkToGroup(@RequestParam("groupName") final String groupName, @RequestParam("path") final String path) {
String zoneName = irodsServices.getCurrentUserZone();
DataGridGroup group = groupService.findByGroupnameAndZone(groupName, zoneName);
if (group == null) {
return REQUEST_ERROR;
}
Set<String> toAdd = new HashSet<String>();
toAdd.add(path);
groupBookmarkService.updateBookmarks(group, toAdd, null);
return REQUEST_OK;
}
use of com.emc.metalnx.core.domain.entity.DataGridGroup in project metalnx-web by irods-contrib.
the class GroupBookmarkController method removeBookmarkFromGroup.
@RequestMapping(value = "/removeBookmarkFromGroup/")
@ResponseBody
public String removeBookmarkFromGroup(@RequestParam("groupName") final String groupName, @RequestParam("path") final String path) {
String zoneName = irodsServices.getCurrentUserZone();
DataGridGroup group = groupService.findByGroupnameAndZone(groupName, zoneName);
if (group == null) {
return REQUEST_ERROR;
}
Set<String> toRemove = new HashSet<String>();
toRemove.add(path);
boolean operationResult = groupBookmarkService.updateBookmarks(group, null, toRemove);
return operationResult ? REQUEST_OK : REQUEST_ERROR;
}
use of com.emc.metalnx.core.domain.entity.DataGridGroup in project metalnx-web by irods-contrib.
the class PermissionsController method addGroupToCreationList.
@RequestMapping(value = "/addGroupPermissions/")
@ResponseBody
public String addGroupToCreationList(@RequestParam("permission") final String permission, @RequestParam("groups") final String groups, @RequestParam("path") final String path, @RequestParam("bookmark") final boolean bookmark, @RequestParam("recursive") final boolean recursive) throws DataGridConnectionRefusedException {
boolean operationResult = true;
String[] groupParts = groups.split(",");
DataGridPermType permType = DataGridPermType.valueOf(permission);
loggedUser = luu.getLoggedDataGridUser();
for (String group : groupParts) {
if (gs.findByGroupname(group).isEmpty()) {
return REQUEST_ERROR;
}
}
for (String group : groupParts) {
operationResult &= ps.setPermissionOnPath(permType, group, recursive, loggedUser.isAdmin(), path);
}
// Updating bookmarks for the recently-created permissions
if (bookmark) {
Set<String> bookmarks = new HashSet<String>();
bookmarks.add(path);
// Getting list of groups and updating bookmarks
List<DataGridGroup> groupObjects = gs.findByGroupNameList(groupParts);
for (DataGridGroup g : groupObjects) {
gBMS.updateBookmarks(g, bookmarks, null);
}
}
return operationResult ? REQUEST_OK : REQUEST_ERROR;
}
use of com.emc.metalnx.core.domain.entity.DataGridGroup in project metalnx-web by irods-contrib.
the class BrowseController method getDirectoriesAndFilesForGroupForm.
/**
* Finds all collections and files existing under a certain path for a given
* group name.
*
* @param model
* @param path
* start point to get collections and files
* @param groupName
* group that all collections and files permissions will be listed
* @return
* @throws DataGridConnectionRefusedException
* @throws JargonException
* @throws FileNotFoundException
*/
@RequestMapping(value = "/getDirectoriesAndFilesForGroupForm")
public String getDirectoriesAndFilesForGroupForm(final Model model, @RequestParam("path") String path, @RequestParam("groupName") final String groupName, @RequestParam("retrievePermissions") final boolean retrievePermissions) throws DataGridConnectionRefusedException, FileNotFoundException, JargonException {
if (path == null || path == "") {
path = "/";
}
List<DataGridCollectionAndDataObject> list = null;
list = cs.getSubCollectionsAndDataObjectsUnderPath(path);
Set<String> readPermissions = null;
Set<String> writePermissions = null;
Set<String> ownershipPermissions = null;
Set<String> inheritPermissions = null;
if (retrievePermissions) {
readPermissions = cs.listReadPermissionsForPathAndGroup(path, groupName);
writePermissions = cs.listWritePermissionsForPathAndGroup(path, groupName);
ownershipPermissions = cs.listOwnershipForPathAndGroup(path, groupName);
inheritPermissions = cs.listInheritanceForPath(path);
} else {
readPermissions = new HashSet<String>();
writePermissions = new HashSet<String>();
ownershipPermissions = new HashSet<String>();
inheritPermissions = new HashSet<String>();
}
List<String> groupBookmarks = new ArrayList<String>();
if (groupName.length() > 0) {
DataGridGroup group = groupService.findByGroupname(groupName).get(0);
groupBookmarks = groupBookmarkService.findBookmarksForGroupAsString(group);
}
model.addAttribute("dataGridCollectionAndDataObjectList", list);
model.addAttribute("currentPath", path);
model.addAttribute("encodedCurrentPath", URLEncoder.encode(currentPath));
model.addAttribute("readPermissions", readPermissions);
model.addAttribute("writePermissions", writePermissions);
model.addAttribute("ownershipPermissions", ownershipPermissions);
model.addAttribute("inheritPermissions", inheritPermissions);
model.addAttribute("addBookmark", groupBookmarkController.getAddBookmark());
model.addAttribute("removeBookmark", groupBookmarkController.getRemoveBookmark());
model.addAttribute("groupBookmarks", groupBookmarks);
return "collections/treeViewForGroupForm :: treeView";
}
use of com.emc.metalnx.core.domain.entity.DataGridGroup in project metalnx-web by irods-contrib.
the class UserController method showAddUserForm.
/**
* Responds the request for the url "add/". It adds a new UserForm to the Model
* and sets the form's action to "add".
*
* @param model
* @return the userForm template
* @throws DataGridConnectionRefusedException
*/
@RequestMapping(value = "add/", method = RequestMethod.GET)
public String showAddUserForm(Model model) throws DataGridConnectionRefusedException {
String[] groupsList = new String[1];
groupsToBeAdded = new ArrayList<String>();
String currentZone = irodsServices.getCurrentUserZone();
DataGridGroup publicGroup = groupService.findByGroupnameAndZone("public", currentZone);
groupsList[0] = String.valueOf(publicGroup.getDataGridId());
model.addAttribute("addReadPermissionsOnDirs", addReadPermissionsOnDirs);
model.addAttribute("addWritePermissionsOnDirs", addWritePermissionsOnDirs);
model.addAttribute("addOwnerOnDirs", addOwnerOnDirs);
model.addAttribute("user", new UserForm());
model.addAttribute("groups", groupService.findAll());
model.addAttribute("zones", zoneService.findAll());
model.addAttribute("userZone", "");
model.addAttribute("groupList", groupsList);
model.addAttribute("requestMapping", "/users/add/action/");
model.addAttribute("profiles", userProfileService.findAll());
model.addAttribute("userTypes", userService.listUserTypes());
return "users/userForm";
}
Aggregations