Package com.denimgroup.threadfix.data.entities

Examples of com.denimgroup.threadfix.data.entities.Role


        result.rejectValue("name", MessageConstants.ERROR_NAMETAKEN);
                return FormRestResponse.failure("Errors", result);
      }
     
      if (user.getGlobalRole() != null && user.getGlobalRole().getId() != null) {
        Role role = roleService.loadRole(user.getGlobalRole().getId());
        if (role == null) {
          user.setGlobalRole(null);
        }
      }
     
View Full Code Here


            listRole.setCanDelete(roleService.canDelete(listRole));
        }

        model.addAttribute("successMessage", ControllerUtils.getSuccessMessage(request));
        model.addAttribute("errorMessage", ControllerUtils.getErrorMessage(request));
        model.addAttribute("role", new Role());
        model.addAttribute("editRole", new Role());
        return "config/roles/index";
    }
View Full Code Here

        return RestResponse.success(role);
    }

    @RequestMapping(value = "/{roleId}/delete", method = RequestMethod.POST)
  public @ResponseBody Object delete(@PathVariable("roleId") int roleId) {
    Role role = roleService.loadRole(roleId);
   
    if (role != null) {
      String roleName = role.getDisplayName();
      if (roleService.canDelete(role)) {
                boolean shouldForceLogout = userService.shouldReloadUserIfRoleChanged(role);

        roleService.deactivateRole(roleId);
View Full Code Here

  }

  @Override
  @Transactional(readOnly = false)
  public void deactivateRole(int id) {
    Role role = loadRole(id);
    if (role != null && canDelete(role)) {
      role.setActive(false);

            for (User user : role.getUsers()) {
                user.setGlobalRole(null);
                user.setHasGlobalGroupAccess(false);
                userDao.saveOrUpdate(user);
            }
View Full Code Here

    if (name == null || name.trim().length() == 0) {
      result.rejectValue("displayName", null, null, "This field cannot be blank");
      return FIELD_ERROR;
    }
   
    Role databaseRole = loadRole(name.trim());
   
    if (databaseRole != null && !databaseRole.getId().equals(role.getId())) {
            result.rejectValue("displayName", MessageConstants.ERROR_NAMETAKEN);
      return FIELD_ERROR;
    }
   
    if (name.length() > Role.NAME_LENGTH) {
      return FIELD_ERROR;
    }
   
    if (databaseRole != null) {
      if (databaseRole.getCanManageUsers() && !role.getCanManageUsers() &&
          !userDao.canRemovePermissionFromRole(role.getId(), "canManageUsers")) {
        return "You cannot remove the Manage Users privilege from this role.";
      }
     
      if (databaseRole.getCanManageRoles() && !role.getCanManageRoles() &&
          !userDao.canRemovePermissionFromRole(role.getId(), "canManageRoles")) {
        return "You cannot remove the Manage Roles privilege from this role.";
      }
    }
   
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.entities.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.