Package gwtappcontainer.shared.apis

Examples of gwtappcontainer.shared.apis.APIResponse


     
      if (0 == allProps.size()) {
        throw new APIException(Status.ERROR_RESOURCE_DOES_NOT_EXIST, "No users available");       
      }
     
      APIResponse resp = new APIResponse();
      resp.statusCode = Status.SUCCESS;
      resp.object = allProps;
     
      return resp;
     
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here


      ensureRole(user, Role.PORTAL_ADMIN);     
                     
      UserRepository repository = new UserRepository();
      UserProp prop = repository.addUser(email);
     
      APIResponse resp = new APIResponse();
      resp.statusCode = Status.SUCCESS;
      resp.object = prop;
      return resp;
     
    } catch (Exception ex) {
      return new APIResponse(ex);
    }
  }
View Full Code Here

      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

      //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

   
    @Test
    public void anyUserModificationWithoutLoginGivesAuthenticationError() {
      AdminAPI api = new AdminAPI();
     
      APIResponse resp = api.addUser("dummy@dummy.com", null);
      assertTrue(resp.statusCode == Status.ERROR_LOGIN_REQUIRED);
     
      try {
      resp = api.assignRoleToUser("dummy", "dummy", null);
      } catch (APIException ex) {
View Full Code Here

      api.setGateKeeper(mockGateKeeper);
     
      User user = UserServiceFactory.getUserService().getCurrentUser();
     
      String email = "dummy_" + UUID.randomUUID() + "@dummy.com";
      APIResponse resp = api.addUser(email, user);
      assertTrue(resp.statusCode == Status.SUCCESS);
     
      //first add role
      String role = "role_" + UUID.randomUUID();
      resp = api.addRole(role, user);
View Full Code Here

      api.setGateKeeper(mockGateKeeper);
     
      User user = UserServiceFactory.getUserService().getCurrentUser();
     
      String email = "dummy_" + UUID.randomUUID() + "@dummy.com";
      APIResponse resp = api.addUser(email, user);
      assertTrue(resp.statusCode == Status.SUCCESS);
     
      //first add role
      String role = "role_" + UUID.randomUUID();
      resp = api.addRole(role, user);
View Full Code Here

      api.setGateKeeper(mockGateKeeper);
     
      User user = UserServiceFactory.getUserService().getCurrentUser();
     
      String email = "dummy_" + UUID.randomUUID() + "@dummy.com";
      APIResponse resp = api.addUser(email, user);
      assertTrue(resp.statusCode == Status.SUCCESS);
     
      //first add role
      String role = "role_" + UUID.randomUUID();
      resp = api.addRole(role, user);
View Full Code Here

      api.setGateKeeper(mockGateKeeper);
     
      User user = UserServiceFactory.getUserService().getCurrentUser();
     
      String email = "dummy_" + UUID.randomUUID() + "@dummy.com";
      APIResponse resp = api.addUser(email, user);
      assertTrue(resp.statusCode == Status.SUCCESS);
     
      resp = api.addUser(email, user);
      assertTrue(resp.statusCode == Status.ERROR_RESOURCE_ALREADY_EXISTS);
    }
View Full Code Here

      api.setGateKeeper(mockGateKeeper);
     
      //2. add a role and ensure it is present
      User user = UserServiceFactory.getUserService().getCurrentUser();
      String role = "testdummy_" + UUID.randomUUID();
      APIResponse resp = api.addRole(role, user);
      assertTrue(resp.statusCode == Status.SUCCESS);
     
    List<RoleProp> roles = (List<RoleProp>) api.getAllRoles().object;
   
    assertTrue("added role should be present",
View Full Code Here

TOP

Related Classes of gwtappcontainer.shared.apis.APIResponse

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.