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

Identify the directive in the loadPermissions function #230

Closed wfpaisa closed 10 months ago

wfpaisa commented 1 year ago

I'm submitting a...


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

Current behavior

be able to identify the type of directive to be able to make an Only or an except

Expected behavior

<div
  ... *ngxPermissionsOnly="['PCO_SADM']"
  ... *ngxPermissionsExcept="['PCO_SADM']"
>
this.permissions.loadPermissions(roles, (permissionName, permissionStore, permissionType <----) => {

     ----> console.log('-- permissionType:', permissionType);

      if(permissionType === '~only') return ...
      if(permissionType === '~exept') return...

      return !!permissionStore[permissionName as string];
});
AlexKhymenko commented 1 year ago

@wfpaisa Can You please create pr for this feature?