sysadmin42
Technical User
- May 6, 2005
- 138
I am about to create a new site with some pretty complex user permission work. Previously, I have simply had a table (MySQL) like this example:
id - autoindex
user_id - smallint, linked to the user table with their name and everything
permission_1 - enum(0,1)
permission_2 - enum(0,1)
etc...
then, at the beginning of the pages requiring permissions, just getting the value of the appropriate permission. 0=not allowed, 1=allowed. Also, say there is an office location table and you can let users only see certain offices' info:
allowed_locations - varchar(100) Example value: "1,4,8,9,10"
Is there a more better and/or efficient way to set up permissions in general?
id - autoindex
user_id - smallint, linked to the user table with their name and everything
permission_1 - enum(0,1)
permission_2 - enum(0,1)
etc...
then, at the beginning of the pages requiring permissions, just getting the value of the appropriate permission. 0=not allowed, 1=allowed. Also, say there is an office location table and you can let users only see certain offices' info:
allowed_locations - varchar(100) Example value: "1,4,8,9,10"
Is there a more better and/or efficient way to set up permissions in general?