Package org.cipres.treebase.domain.admin

Examples of org.cipres.treebase.domain.admin.UserRole


  /**
   *
   * @see org.cipres.treebase.domain.admin.UserHome#getUserRole()
   */
  public UserRole getUserRole() {
    UserRole role = new UserRole();
    role.setAuthority("User");
    return role;
  }
View Full Code Here


   *
   * @see org.cipres.treebase.domain.admin.UserHome#findUserRole(java.lang.String)
   */
  public UserRole findUserRole(String pUserRole) {
    if (UserRole.ROLE_USER.equals(pUserRole)) {
      UserRole role = new UserRole();
      role.setAuthority("User");
      return role;
    }
    return null;
  }
View Full Code Here

    user.setPassword("testPassword");

    String email = "test@cipres.treebase.org";
    user.setEmailAddressString(email);

    UserRole testRole = new UserRole();
    testRole.setAuthority("TEST");
    user.setRole(testRole);

    UserHome fixture = getUserHome();
    fixture.store(testRole);
    fixture.store(user);
View Full Code Here

 
  protected boolean isAdmin(HttpServletRequest request) {
        String username = request.getRemoteUser();
        User currentUser = getUserService().findUserByName(username);
        if (currentUser == null) return false;
        UserRole role = currentUser.getRole();
        if (role == null) return false;
        return role.isAdmin();
  }
View Full Code Here

    // update role if it is changed:
    if (!TreebaseUtil.isEmpty(updateRole) && !updateRole.equals(user.getRoleDescription())) {
      if (currentUser.getRole().isAdmin()) {

        if (!TreebaseUtil.isEmpty(updateRole)) {
          UserRole newRole = getUserService().findUserRole(updateRole);

          if (newRole != null) {
            user.setRole(newRole);
          }
        }
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.admin.UserRole

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.