Examples of UserProp


Examples of gwtappcontainer.shared.apis.admin.UserProp

    assertTrue(resp.statusCode == Status.SUCCESS);
   
    //check if role exists
    AdminAPI adminApi = new AdminAPI();
    resp = adminApi.getRolesForUser(email);
    UserProp prop = (UserProp) resp.object;
   
    String role = Roles.CONTENT_ADMIN_PREFIX + tag.toUpperCase();
    assertTrue(Util.isRolePresent(prop.roles, role));       
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

      @Named("role") String role, User user) { 
    try {   
      ensureRole(user, Role.PORTAL_ADMIN);           
           
      UserRepository repository = new UserRepository();
      UserProp prop = repository.changeUserPermission(email, role, true);
     
      return new APIResponse(Status.SUCCESS, prop);
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

    try
      ensureRole(user, Role.PORTAL_ADMIN);
      //GateKeeper.throwExceptionIfNeitherPortalAdminNorDeveloper(user);
           
      UserRepository repository = new UserRepository();
      UserProp prop = repository.changeUserPermission(email, role, false);
     
      return new APIResponse(Status.SUCCESS, prop);
     
    } catch (Exception ex) {
      return new APIResponse(ex);
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

  private static final String NAMESPACE = DatastoreNamespaces.ADMIN;
 
  UserProp addUser(String email) {
             
    //email should not be already present
    UserProp prop = getUserByEmail(email);
    if (null != prop) {
      throw new APIException(Status.ERROR_RESOURCE_ALREADY_EXISTS,
          "User [" + email + "] is already present with id [" + prop.id + "]");           
    }
   
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

    NamespaceManager.set(NAMESPACE);
   
    UserEntity entity = ofy().consistency(Consistency.STRONG).load().type(UserEntity.class).
        filter("email", email.toLowerCase()).first().get();
       
    UserProp prop = null;
    if (null != entity)
      prop = entity.toProp();
   
    return prop;
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

  @Index String email;
 
  @Load List<Ref<RoleEntity>> roles;

  public UserProp toProp() {
    UserProp prop = new UserProp();
   
    prop.id = id;
    prop.email = email;
   
    prop.roles = new ArrayList<RoleProp>();   
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

  public boolean ensureValidUser(User user) {
    //should be logged in
    if (null == user)      
      throw new APIException(Status.ERROR_LOGIN_REQUIRED, "User not logged in");
   
    UserProp prop = getUserProp(user);
   
    //should be a valid user
    if (null == prop)
      throw new APIException(Status.ERROR_INVALID_USER,
          "Invalid user [" + user.getEmail() + "]");   
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

   
    //should be logged in
    if (null == user)      
      throw new APIException(Status.ERROR_LOGIN_REQUIRED, "User not logged in");
   
    UserProp prop = getUserProp(user);
   
    //should be a valid user
    if (null == prop)
      throw new APIException(Status.ERROR_INVALID_USER,
          "Invalid user [" + user.getEmail() + "]");   
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

   
    throw new APIException(Status.ERROR_INSUFFICIENT_PERMISSION, errMessage);   
  }
     
  protected UserProp getUserProp(User user) {               
    UserProp prop = new UserRepository().getUserByEmail(user.getEmail());               
    return prop;
  }
View Full Code Here

Examples of gwtappcontainer.shared.apis.admin.UserProp

  public APIResponse getRolesForUser(@Named("email") String email) {   
    try {                         
     
      UserRepository repository = new UserRepository();
      email = email.toLowerCase();
      UserProp prop = repository.getUserByEmail(email);
     
      APIResponse resp = new APIResponse();
     
      if (null == prop) {
        resp.statusCode = Status.ERROR_INVALID_USER;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.