How to make ngxPermissionsExcept work correctly

528 Views Asked by At

I have recently started using ngxPermissions (https://www.npmjs.com/package/ngx-permissions#multiple-permissions) for handling accesses in my angular app. However, I face difficulties when I have multiple roles for the same user. Example:

<ng-template [ngxPermissionsExcept]="['SPECIAL_ROLE']">
    // special text here
</ng-template>

I want that the above code should be visible to everyone who has a role other than SPECIAL_ROLE. Now I have a user who has following roles:

['SPECIAL_ROLE', 'NORMAL_ROLE', 'SUPER_ROLE']

Since this user has roles other than SPECIAL_ROLE too, I expect the above code to be displayed to such a user. However, it turns out that using my code above this user do not see this code at all.

Cam someone please suggest how to achieve the above use case.

Edit: I have tried few things and realize that may be ngxPermissions uses just the first role from the array to arrive at the decision. Is it so ? Thanks

0

There are 0 best solutions below