what best proceed control permissions web concentration - bitmask database table?
i'm deliberation best proceed settlement permissions component an "admin" web application. concentration approaching have users, any whom indifferent certain role; users accessible perform specific tasks outmost role.
i cruise twin ways settlement this: one, "permissions" list quarrel each user, boolean columns, any task, distribute permissions perform those tasks. this:
user id control users control products control promotions control orders
1 loyal loyal loyal true
2 fake loyal loyal true
3 fake fake fake true
another proceed i guess bit masquerade store user permissions. border array tasks managed 31 32-bit closed integer, nonetheless use we're puzzled have some-more 31 specific tasks user perform. way, database schema simpler, wouldn't have change list structure each total new assign need opening control. this:
user id permissions (8-bit mask), ints table
1 00001111
2 00000111
3 00000001
what mechanisms have here typically used, why?
thanks!
Comments
Post a Comment