Open yd021976 opened 6 years ago
@yd021976 Ohhhhhh didn't expect this one :-) Not sure how to implement it.... For now you can just nest directive in directive
<div *ngxPermissionsOnly="'write'; authorisedStrategy: disabledFunc; unauthorisedStrategy:enableFunc">
<div *ngxPermissionsOnly="'READ '; authorisedStrategy: something else; unauthorisedStrategy:
something ele">123</div>
</div>`}
@AlexKhymenko Humm... didn't get it right now :-) If I understand I should create as many strategy functions as permissions ? I'll give it a try, but I'm afraid the DOM manipulation will be tricky because of parsing nested DOM elements (parent, sibling, child etc...).
For example, how in strategy function should I know that I must get the parent element instead of sibling ?
Are you ok if I work on a PR and submit it to you ? Give me some weeks because it's just a hobby :-)
Hi @AlexKhymenko , i've forked your project and upgrade it to angular V7.0.1. So I've made many changes, more particularly in project structure and use the ng-packagr and angular library instead of your custom gulp to build library ==> This way, it is very simple to debug library with sourcemaps.
Note that I never use karma or other unit automated test tools, so I removed the root UT conf files and didn't update the new ones generated by Angular (says ng new library).
Do you want create a PR to upgrade your lib to angular V7 with my work ?
Thank you !
@yd021976 Im always open to pull requests, just test should be working, cause they saved me so many times :-)
Great ! I've created PR #89 for this. I'd be happy if you validate it :-)
I'm submitting a...
Hi, first, thank you for this great angular module !
Current behavior
Implement with success a authorizedStrategy and/or unauthorisedStrategy. So I can do whatever I want on the DOM element based on the authorized status (true or false).
Expected behavior
I want to do a little bit more complexe strategy behavior based on authorized/unauthorized permissions.
For example, I would know if the unauthorized permission was READ or UPDATE (or whatever...). In my strategy I then can apply multiple DOM manipulations like disable field, hide (or even salt) content, hide section completely ... So, I need a way to know what permissions were rejected or accepted when my strategy is called. After many tries, I can't find a way to get which permissions success/failed in the strategy function.
It would be great if you can add "authorisedPermissions" and "unauthorisedPermissions" in the strategy function signature in addition of "templateRef".
Environment