Search in sources :

Example 11 with DataGridGroup

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;
}
Also used : DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup) HashSet(java.util.HashSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 12 with DataGridGroup

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;
}
Also used : DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup) HashSet(java.util.HashSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 13 with DataGridGroup

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;
}
Also used : DataGridPermType(com.emc.metalnx.core.domain.entity.enums.DataGridPermType) DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup) HashSet(java.util.HashSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 14 with DataGridGroup

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";
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) ArrayList(java.util.ArrayList) DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with DataGridGroup

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";
}
Also used : DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup) UserForm(com.emc.metalnx.modelattribute.user.UserForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DataGridGroup (com.emc.metalnx.core.domain.entity.DataGridGroup)23 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 DataGridUser (com.emc.metalnx.core.domain.entity.DataGridUser)6 UserProfile (com.emc.metalnx.core.domain.entity.UserProfile)5 ArrayList (java.util.ArrayList)4 JargonException (org.irods.jargon.core.exception.JargonException)4 HashSet (java.util.HashSet)3 Query (org.hibernate.Query)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)2 UserForm (com.emc.metalnx.modelattribute.user.UserForm)2 UserProfileForm (com.emc.metalnx.modelattribute.user.profile.UserProfileForm)2 HashMap (java.util.HashMap)2 DuplicateDataException (org.irods.jargon.core.exception.DuplicateDataException)2 UserGroupAO (org.irods.jargon.core.pub.UserGroupAO)2 User (org.irods.jargon.core.pub.domain.User)2 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)1 DataGridZone (com.emc.metalnx.core.domain.entity.DataGridZone)1 DataGridPermType (com.emc.metalnx.core.domain.entity.enums.DataGridPermType)1 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)1