Example #1
0
  @Override
  public boolean checkAccess(Request request, String identifier) throws SystemException {

    AuthorizationHandler authHandler = null;
    log.debug("Checking access for request " + request.getClass() + " identifier " + identifier);
    if (request instanceof UploadRequest) {
      // Upload request handling.
      log.debug("Handle auth request for upload!");
      UploadRequest upRquest = (UploadRequest) request;
      UploadHandlerMapping mapTo = uploadHandlers.get(upRquest.getDataType());
      authHandler = authorizationInstanceMap.get(mapTo.getAuthorizationHandlerClassName());
    } else {
      HandlerMapping requestToHandlerMapping = handlerMapping.get(request.getClass().getName());
      authHandler =
          authorizationInstanceMap.get(requestToHandlerMapping.authorizationHandlerClassName);
    }

    if (authHandler == null) {
      return false;
    }
    return authHandler.isAuthorized(request, permissionAdapter.getPermissions(identifier));
  }
Example #2
0
  @Override
  public Response handle(Request request) throws HandlerNotFoundException {

    RequestHandler handler = getHandler(request.getClass());
    return handler.handle(request);
  }