Search in sources :

Example 1 with GroupForm

use of com.emc.metalnx.modelattribute.group.GroupForm in project metalnx-web by irods-contrib.

the class GroupController method showAddGroupForm.

/**
 * Responds the request for the url "add/". It adds a new GroupForm 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 showAddGroupForm(Model model) throws DataGridConnectionRefusedException {
    groupForm = new GroupForm();
    model.addAttribute("groupForm", groupForm);
    model.addAttribute("requestMapping", "/groups/add/action/");
    // gets all users from iRODS to be attached to a group
    List<DataGridUser> users = userService.findAll();
    String[] membersList = new String[0];
    usersToBeAdded = new ArrayList<String>(Arrays.asList(membersList));
    model.addAttribute("addReadPermissionsOnDirs", addReadPermissionsOnDirs);
    model.addAttribute("addWritePermissionsOnDirs", addWritePermissionsOnDirs);
    model.addAttribute("addOwnerOnDirs", addOwnerOnDirs);
    model.addAttribute("addInheritanceOnDirs", addInheritanceOnDirs);
    model.addAttribute("users", users);
    model.addAttribute("membersList", membersList);
    model.addAttribute("resultSize", users.size());
    model.addAttribute("foundUsers", users.size() > 0);
    model.addAttribute("zones", zoneService.findAll());
    model.addAttribute("groupZone", "");
    return "groups/groupForm";
}
Also used : GroupForm(com.emc.metalnx.modelattribute.group.GroupForm) DataGridUser(com.emc.metalnx.core.domain.entity.DataGridUser)

Example 2 with GroupForm

use of com.emc.metalnx.modelattribute.group.GroupForm in project metalnx-web by irods-contrib.

the class GroupController method showModifyGroupForm.

/**
 * Controller that shows the modification of group view.
 *
 * @param username
 * @param additionalInfo
 * @param model
 * @return
 * @throws DataGridConnectionRefusedException
 */
@RequestMapping(value = "modify/{groupname}/{additionalInfo}/", method = RequestMethod.GET)
public String showModifyGroupForm(@PathVariable String groupname, @PathVariable String additionalInfo, Model model) throws DataGridConnectionRefusedException {
    List<DataGridUser> users = userService.findAll();
    currentGroup = groupService.findByGroupnameAndZone(groupname, additionalInfo);
    String[] membersList;
    if (currentGroup != null) {
        membersList = groupService.getMemberList(currentGroup);
    } else {
        membersList = new String[0];
    }
    usersToBeAdded = new ArrayList<String>(Arrays.asList(membersList));
    currentGroup = groupService.findByGroupnameAndZone(groupname, additionalInfo);
    GroupForm groupForm = new GroupForm();
    if (currentGroup != null) {
        groupForm.setGroupname(groupname);
        groupForm.setAdditionalInfo(currentGroup.getAdditionalInfo());
        groupForm.setDataGridId(currentGroup.getDataGridId());
    }
    model.addAttribute("groupBookmarks", groupBookmarkService.findBookmarksForGroupAsString(currentGroup));
    model.addAttribute("groupForm", groupForm);
    model.addAttribute("requestMapping", "/groups/modify/action/");
    model.addAttribute("addReadPermissionsOnDirs", addReadPermissionsOnDirs);
    model.addAttribute("addWritePermissionsOnDirs", addWritePermissionsOnDirs);
    model.addAttribute("addOwnerOnDirs", addOwnerOnDirs);
    model.addAttribute("addInheritanceOnDirs", addInheritanceOnDirs);
    model.addAttribute("users", users);
    model.addAttribute("membersList", membersList);
    model.addAttribute("resultSize", users.size());
    model.addAttribute("foundUsers", users.size() > 0);
    model.addAttribute("zones", zoneService.findAll());
    model.addAttribute("groupZone", additionalInfo);
    return "groups/groupForm";
}
Also used : GroupForm(com.emc.metalnx.modelattribute.group.GroupForm) DataGridUser(com.emc.metalnx.core.domain.entity.DataGridUser)

Aggregations

DataGridUser (com.emc.metalnx.core.domain.entity.DataGridUser)2 GroupForm (com.emc.metalnx.modelattribute.group.GroupForm)2