fnakstad / angular-client-side-auth

One way to implement authentication/authorization in Angular applications
http://angular-client-side-auth.herokuapp.com/
MIT License
1.63k stars 346 forks source link

Store string value of role instead of bitmask #18

Closed fnakstad closed 11 years ago

fnakstad commented 11 years ago

Since bitmasks of user roles and access levels are generated on the fly, they can differ if items in their respective arrays are moved around. This can become a huge problem if a user's role (the Number value) is persisted to the database, then the array items are moved around, leading to each role getting a different bitmask from what has previously been stored in the database. This can be rectified by storing the String value of the role (or some other kind of unique identifier) instead of the Number value.