RafaelVidaurre / angular-permission

Simple route authorization via roles/permissions
MIT License
1.13k stars 212 forks source link

Additional warning if `only` and `except` are `undefined`? #420

Closed sygnowskip closed 7 years ago

sygnowskip commented 7 years ago

What do you think about additional warning at console (if enabled maybe?) when a PermissionDirective is executed with only and except as undefined?

In our system, we have an object with all permissions as properties, e.g.: var availablePermissions = { allowView: "allowView", allowEdit: "allowEdit" }

If I make a mistake in name of property, than the value of only/except is undefined and the validation for required permission pass, e.g.:

<button id="edit" permissions permissions-only='availablePermissions.allowEdt'/> (allowEdt instead of allowEdit)

I think that configurable (enabled/disabled) warning, if both of them are undefined (except/only) will be very helpful in development.

angular-permission: 2.5.0 angular: 1.6.3

sygnowskip commented 7 years ago

We've changed our code and an approach to this problem - closed.