rondog Posted August 28, 2008 Share Posted August 28, 2008 I dont know if it would be user lever, however my issue is lets say we have users and then we have admins. The site has a bunch of videos in sections. The admins set which sections each user is allowed to see. Would that be a user level system or something simpler? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 28, 2008 Share Posted August 28, 2008 I use a 2 part system for updating use permissions part 1 is each account is given an initial "level" so they are Admin/ Power User/ User/ Super admin etc. This grants them the abilities of that level. When I add new functions to my user management system I set which user types can get them. Secondly all the permissions granted are stored in a mysql table that has a structure of UserID FunctionID so if I want I can add/remove functions for certain users making each account completely customizable. Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 29, 2008 Share Posted August 29, 2008 one option, relevant specifically to your situation here, is just to have a simple many-many table relationship: user_id | video_id when the admin allow a user to watch a video, insert the corresponding entry into the table. then, when you want to check permissions, you simply need to check if the entry exists. similarly, when admin no longer want a user to view it, delete the entry. you'll want an overall distinction between admin and users, which is a simple matter of putting a boolean flag in the users table. it's not extensible (it can only be true or false for admin status), but it will do the trick if you never intend to get anymore complicated. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted August 30, 2008 Share Posted August 30, 2008 [...] but it will do the trick if you never intend to get anymore complicated. "Never" is the keyword here. You cannot possibly know if you at a later time would want a group between admins and regular users, say a moderator for instance. Quote Link to comment Share on other sites More sharing options...
ardyandkari Posted September 16, 2008 Share Posted September 16, 2008 instead of boolean, i would use tinyint. that way you can have 1 be user 2 be admin, and if you want to add later, you can make 3 be mod or whatever. then you have 9 different options. Quote Link to comment Share on other sites More sharing options...
d_barszczak Posted September 16, 2008 Share Posted September 16, 2008 The way i have done this in the past would be to have a users table, a groups table and a members table. Users: Uid | Username | Password 1 System ChangeMe Groups: Gid | Groupname 1 Administrators 12 Premium Membership Members: Mid | Uid | Gid 1 1 1 Then you do the same thing for your videos Video_Members: id | vid | gid 1 | 25 | 1 2 | 25 | 12 In the above example administrators and premium members would have access to video 25. This might seem complicated at first but once you develop some oop functions to manage the memberships then it becomes a lot less complicated in the long run. Plus you could then use the same membership system should you add other features to the site. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.