Skip to content

RBAC Permissions Module

The RBAC-Permissions UI module is used to provide an easy access to user permissions, as to provide a way of knowing if a user has a required permission. This module is responsible of adding an entry in the store called rbacPermissions, that stores all the permissions of the logged user (if any).

Using the permissions service

This module also exposes a way to check if a user has any of a given list of permissions. In order to access this feature, you have to inject the authorizationService and access the hasAnyPermissions method, passing a list of permissions as parameter. If any of these permissions exists in the user's permissions list, it will be returned an observable of true; otherwise it will return an observable of false.

TypeScript
1
2
3
4
import { AuthorizationService } from '@itsynch/rbac/permissions';

let authService: AuthorizationService
let result$ = authService.hasAnyPermission(['aims/issues/read'])

Using this service allows you to implement a certain logic in your application based in the user permissions, such as allowing it to see sensible information.