Package com.baasbox.enumerations

Examples of com.baasbox.enumerations.Permissions


      }
      Iterator<Entry<String, JsonNode>> itAction = aclJson.fields(); //read,update,delete
      while (itAction.hasNext()){
        Entry<String, JsonNode> nextAction = itAction.next();
        String action = nextAction.getKey();
        Permissions actionPermission = null;
        if (action.equalsIgnoreCase("read"))
          actionPermission=Permissions.ALLOW_READ;
        else if (action.equalsIgnoreCase("update"))
          actionPermission=Permissions.ALLOW_UPDATE;
        else if (action.equalsIgnoreCase("delete"))
View Full Code Here


   
    @With ({UserCredentialWrapFilter.class,ConnectToDBFilter.class,ExtractQueryParameters.class})
    public static Result grantOrRevokeToRole(String id,String rolename, String action, boolean grant) {
      try {
        Permissions permission=PermissionsHelper.permissionsFromString.get(action.toLowerCase());
        if (grant) FileService.grantPermissionToRole(id, permission, rolename);
        else       FileService.revokePermissionToRole(id, permission, rolename);
      } catch (IllegalArgumentException e) {
        return badRequest(e.getMessage());
      } catch (RoleNotFoundException e) {
View Full Code Here

    }//grantOrRevokeToRole
   
    @With ({UserCredentialWrapFilter.class,ConnectToDBFilter.class,ExtractQueryParameters.class})
    public static Result grantOrRevokeToUser(String id, String username, String action, boolean grant) {
      try {
        Permissions permission=PermissionsHelper.permissionsFromString.get(action.toLowerCase());
        if (grant) FileService.grantPermissionToUser(id, permission, username);
        else       FileService.revokePermissionToUser(id, permission, username);
      } catch (IllegalArgumentException e) {
        return badRequest(e.getMessage());
      } catch (RoleNotFoundException e) {
View Full Code Here

    private static Result grantOrRevokeToUser(String collectionName, String id,
        String username, String action, boolean grant, boolean isUUID) {
      try {
        //converts uuid in rid
        String rid= DocumentService.getRidByString(id, isUUID);
        Permissions permission=PermissionsHelper.permissionsFromString.get(action.toLowerCase());
        if (permission==null) return badRequest(action + " is not a valid action");
        if (grant) DocumentService.grantPermissionToUser(collectionName, rid, permission, username);
        else       DocumentService.revokePermissionToUser(collectionName, rid, permission, username);
      } catch (RidNotFoundException e) {
        return notFound("id " + id + " not found");
View Full Code Here

    }//grantOrRevokeToUser

    private static Result grantOrRevokeToRole(String collectionName, String id,
        String rolename, String action, boolean grant, boolean isUUID) {
      try {
        Permissions permission=PermissionsHelper.permissionsFromString.get(action.toLowerCase());
        if (permission==null) return badRequest(action + " is not a valid action");
        //converts uuid in rid
        String rid = DocumentService.getRidByString(id, isUUID);
        if (grant) DocumentService.grantPermissionToRole(collectionName, rid, permission, rolename);
        else       DocumentService.revokePermissionToRole(collectionName, rid, permission, rolename);
View Full Code Here

TOP

Related Classes of com.baasbox.enumerations.Permissions

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.