PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 8th, 2004, 12:27 AM
zigote zigote is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Atlanta GA
Posts: 73 zigote User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 11 sec
Reputation Power: 6
Individuals Privileges W/ PHP

What I need is a user manager where I can assign users to specific categories that are pulled from a mysql database.
So instead of user groups I need "Individuals Privileges".

Example:
UserTwo is assigned to group "Authors".
This means that UserTwo could post to any category.

I need UserTwo to be assign to only post in the selected categories and not all of them.

What I'm asking is what would be the best way to handle this?
The user table does have a userLevel Id for groups, but I need to have more control on where they can post.

Should I have another table called "Privileges", and this table would hold all the categories Id's that the user may post to?
If So. How would the query look, Should I use JOIN?

Then use explode for individual privileges?
PHP Code:
if($accessLevel == || in_array("categories"$individualsPrivileges))
{


Reply With Quote
  #2  
Old May 8th, 2004, 04:00 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
My question is, can a user be in two groups at once?

If the answer is yes, then you should have a seperate table containing different privilege levels. Since this is considered a many-to-many relationship (one user can have many privileges, and one privilege would apply to many users), you would need some sort of bridging table that links a user and their privilege.

If a user can only have one privilege, then i'd simply store their privilege as a field in the user table.

If you need any further information on Many to Many relationships, I found a simple, brief, explanation with example here: http://www.sum-it.nl/cursus/dbdesig...h/intro030.php3

Reply With Quote
  #3  
Old May 8th, 2004, 08:58 PM
zigote zigote is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Atlanta GA
Posts: 73 zigote User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 11 sec
Reputation Power: 6
By default "Author" may post into all categories, I needed more control of where a specific User could post.

This way, Yes, I could choose more than one category a User could post in, but the user is still in the same group of "Authors"

Additional Table - "privileges"
userId | CatId | Edit | Delete | Post |
2 | 1 | X | X | 0 |
This would say that userId of 2 could only post in category 1.

The more I think about this the more I'm getting confused.
So an additional table would be the best idea?

Thanks for the reply MadCowDzz, I will check that out and see what I can do about this.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Individuals Privileges W/ PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway