8utt
04-22-2009, 09:22 AM
I have a project I'm trying to set up but I'm not sure how to go about it.
I have a list of projects in a table ( called projects )
What I want to do is add permissions to this either by adding a field on the projects table or the users table.
I want to have the following scenrios,
User A can see every project except project 1
User B can only see project 2
User C can see everything
I was thinking of having 2 columns in the userstable
Allow
Deny
in these fields would be a list of project id's.
any suggestions on the best way of doing this ?
I was thinking of the following way
if allow is empty {
if deny is emtpy {
select * from project
} else {
select * from project where projectid is not in Deny
} else {
select * from project where projectid is in Allow
}
hopefully that makes sense, can someone think of a better way of doing this ? seems a little messy i think
I have a list of projects in a table ( called projects )
What I want to do is add permissions to this either by adding a field on the projects table or the users table.
I want to have the following scenrios,
User A can see every project except project 1
User B can only see project 2
User C can see everything
I was thinking of having 2 columns in the userstable
Allow
Deny
in these fields would be a list of project id's.
any suggestions on the best way of doing this ?
I was thinking of the following way
if allow is empty {
if deny is emtpy {
select * from project
} else {
select * from project where projectid is not in Deny
} else {
select * from project where projectid is in Allow
}
hopefully that makes sense, can someone think of a better way of doing this ? seems a little messy i think