AlexKhymenko / ngx-permissions

Permission and roles based access control for your angular(angular 2,4,5,6,7,9+) applications(AOT, lazy modules compatible
MIT License
936 stars 126 forks source link

How to use Rolle and Permission without Rolle #228

Closed elvispdosreis closed 1 year ago

elvispdosreis commented 1 year ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[X] Documentation issue or request

Expected behavior

I have doubts about how to work with roles and permissions. For example, I have some Roles ['Super Admin', 'Admin', 'User', 'Guest'], but these roles are standard and do not have any permissions within them, but I have some separate permissions that are not linked to any roles. how do i add these check rules in the html ngxPermissionsOnly

Environment


Angular version: 15.2.3
ngx-permissions version: 15.0.1


Browser:
- [X] Chrome (desktop) version 115.057
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX            
AlexKhymenko commented 1 year ago

@elvispdosreis In Your case they are all permissions just concatenate 2 arrays and insert into loadPermissions function. Hope this helps.

elvispdosreis commented 1 year ago

I understand even having Role and Permission, they are stored in just one place, and in case I need to know if the user has a role: SuperAdmin or role: Admin and permission createUser.

How do I do this check in ngxPermissionsOnly

i will use your package with https://spatie.be/docs/laravel-permission/v5/introduction

AlexKhymenko commented 1 year ago

the library is based on permissions. So basically when you write ngxPermissionsOnly=['createUser'] it will check if user has permission createUser.