This topic is locked

Advanced Security Options

3/16/2011 6:20:38 PM
PHPRunner General questions
D
DigitalDean8 author

Hello, I am working on building an asset management system using PHPR 5.3 and need to be able to restrict users to seeing only projects that they are assigned to. Normally I would use the "Users can see and edit their own data only" option in the Advanced Security Options. however in this case it's not a single owner but a group of owners that might be as few as 2 or as many as 100. Does anyone have an idea on how to structure this many to many relationship as far as record "ownership" is concerned?
Do I create an intermediary table that manages ownership and read that? Or rather than using the "Advanced Security Options" should I do a basic SQL statement when building the LIST pages?
Thoughts? Sample Code?
Dean

P
procheck 3/16/2011

Hi Dean,
This is the same question that I had when I started. See the post at the link.
http://www.asprunner.com/forums/topic/14202-security-permission/
In my case, I setup two GroupID's (admin and user) in the Permissions. In the customer table I setup the names of all the admin(owner in your case). In the customer table, the column AccessGroup = admin. A separate column in this table has a unique ID for each group (ie Col GroupID = (GRP1, GRP2 etc..).
A user table with info like name etc.. also has AccessGroup = (1 admin for each group ,many user for each group) plus the GroupID field which links these.
example:
Customer

========
AccessGroup....GroupID....OwnerFirst....OwnerLast

admin ............. GRP1 ..... John ..... Smith

admin ............. GRP2 ..... Jane ..... Doe

admin ............. GRP3 ..... Jimmy ..... Bob
User

====
AccessGroup....GroupID.... UserName

admin ............ GRP1.......Jsmith

User .............. GRP1.......(username)

User .............. GRP1.......
admin ............GRP2..........Jdoe

User ..............GRP2.........

User ..............GRP2.........

User ..............GRP2
To control access to pages, create a view of the user table and give admin access to the view.

You can't check the admin group at the bottom of permissions. You need to set the access individually.
Al