/** * Does the given user has the permission for this protocol? * * @param userId the unique username of the user * @param protocol the protocol * @param permissionName the name of the permission * @return true if the person has the permission; otherwise false */ protected final boolean hasPermission( String userId, ProtocolBase protocol, String permissionName) { return kraAuthorizationService.hasPermission(userId, protocol, permissionName); }
/** * Initialize the Authorizations for a new proposal. The initiator/creator is assigned the * Aggregator role. * * @param document the proposal development document */ protected void initializeAuthorization(ProposalDevelopmentDocument document) { String userId = GlobalVariables.getUserSession().getPrincipalId(); KcAuthorizationService kraAuthService = KcServiceLocator.getService(KcAuthorizationService.class); kraAuthService.addRole(userId, RoleConstants.AGGREGATOR, document); }
protected boolean isAdmin(String userId, String namespace, String role) { return kraAuthorizationService.hasRole(userId, namespace, role); }