Package gwtappcontainer.shared.apps.security

Examples of gwtappcontainer.shared.apps.security.UserProp


 
  @Load HashSet<Ref<RoleEntity>> roles = new HashSet<Ref<RoleEntity>>();
  TreeSet<String> privileges = new TreeSet<String>();
 
  UserProp toProp() {
    UserProp prop = new UserProp();
    prop.email = email;
   
    prop.roles = new TreeSet<RoleProp>()
    for (Ref<RoleEntity> entity : roles)
      prop.roles.add(entity.get().toProp());
View Full Code Here


  }
 
  public APIResponse getUser(@Named("email") String email) {
     
    try {     
      UserProp prop = UserRepository.getUser(email);
           
      APIResponse response = new APIResponse(Status.SUCCESS, prop);
         
      return response;
    } catch (Exception ex) {
View Full Code Here

          "User not logged in");
   
    if (isSuperUser(user.getEmail()))
      return;
   
    UserProp userProp = UserRepository.getUser(user.getEmail());
   
    if (null == userProp)
      throw new APIException(Status.ERROR_INVALID_USER,
          "User [" + user.getEmail() + "] in invalid");   
   
View Full Code Here

          "User not logged in");           
   
    if (isSuperUser(login))
      return;       
   
    UserProp userProp = UserRepository.getUser(login);
   
    if (null == userProp)
      throw new APIException(Status.ERROR_INVALID_USER,
          "User [" + login + "] in invalid");
   
View Full Code Here

          "User not logged in");
   
    if (isSuperUser(login))
      return;
   
    UserProp userProp = UserRepository.getUser(login);
   
    if (null == userProp)
      throw new APIException(Status.ERROR_INVALID_USER,
          "User [" + login + "] in invalid");   
   
View Full Code Here

    assertTrue(user != null);
    assertTrue(user.getEmail().equals(helper.getEmail()));   
   
    SecurityAPI api = new SecurityAPI();
    APIResponse response = api.getUser(helper.getEmail());
    UserProp prop = (UserProp) response.object;
    assertTrue(prop.email.equals(helper.getEmail()));
   
    assertTrue(prop.privileges.contains("TEST"));
   
    //add another privilege.
View Full Code Here

    response = api.addUser("test@Test.com",
        helper.loginWithPrivilege(Privileges.EDIT_USER));   
    assertTrue(response.statusCode == Status.SUCCESS);
   
    response = api.getUser("TEST@tESt.com");
    UserProp userProp = (UserProp) response.object;
    assertTrue(userProp.email.equals("test@test.com"));
       
    //adding the same user again should give correct error
    response = api.addUser("test@TEST.COM",
        helper.loginWithPrivilege(Privileges.EDIT_USER));   
View Full Code Here

    api.assignPrivilegeToRole("role1", "privilege1", helper.loginAsSuperUser());
   
    api.assignPrivilegeToUser("test@test.com", "privilege2", helper.loginAsSuperUser());
    api.assignRoleToUser("test@test.com", "role1", helper.loginAsSuperUser());
       
    UserProp userProp = (UserProp) api.getUser("test@test.com").object;
    assertTrue(userProp.email.equals("test@test.com"));   
    assertTrue(userProp.privileges.contains("PRIVILEGE2"));
    assertTrue(userProp.roles.first().role.equals("ROLE1"));
    assertTrue(userProp.roles.first().privileges.contains("PRIVILEGE1"));       
  }
View Full Code Here

   
    response = api.assignRoleToUser("test@test.com", "role1",
        helper.loginWithPrivilege(Privileges.EDIT_USER));
    assertTrue(response.statusCode == Status.SUCCESS);
   
    UserProp userProp = (UserProp) api.getUser("test@test.com").object;
    assertTrue(userProp.email.equals("test@test.com"));
    assertTrue(userProp.roles.first().role.equals("ROLE1"));
    assertTrue(userProp.roles.first().privileges.contains("PRIVILEGE1"));
  }
View Full Code Here

   
    response = api.unassignRoleToUser("test@test.com", "role2",
        helper.loginWithPrivilege(Privileges.EDIT_USER));   
    assertTrue(response.statusCode == Status.SUCCESS);
   
    UserProp userProp = (UserProp) api.getUser("test@test.com").object;
    assertTrue(userProp.roles.size() == 1);
    assertTrue(userProp.roles.first().role.equals("ROLE1"));
           
    //admin can also unassign
    response = api.unassignRoleToUser("test@test.com", "role1",
View Full Code Here

TOP

Related Classes of gwtappcontainer.shared.apps.security.UserProp

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.