@Override public boolean hasPermission( ExecutionContext context, String repositoryName, String repositorySourceName, String workspaceName, Path absPath, String... actions ) { if (absPath == null) { // we'll let all authenticated users to have rights on the workspaces return true; } try { // we don't care about the resource, this is just a simple example which checks the roles of the subject // against the configured roles in the configuration file authorizationManager.authorize(new POJOResource(absPath), this.authenticatedSubject); return true; } catch (AuthorizationException e) { return false; } }
int permit = authzMgr.authorize(new POJOResource(pojo), subject, roles); if(permit != AuthorizationContext.PERMIT) throw new AuthorizationException(PicketBoxMessages.MESSAGES.authorizationFailedMessage());
int permit = authzMgr.authorize(new POJOResource(pojo), subject, roles); if(permit != AuthorizationContext.PERMIT) throw new AuthorizationException(PicketBoxMessages.MESSAGES.authorizationFailedMessage());