[SOLVED] Looking for better user view control |
12/22/2011 9:01:50 AM |
PHPRunner General questions | |
C
crhys author
Hi, |
|
C
|
chuckbower 12/22/2011 |
You can add code to the "Before SQL Query" event on all the appropriate pages (List, View, Edit, Export, etc): Hi, This query may have been answered before but I cannot find the answer, I am looking for a better way to stop users seeing records that are not applicable to them. My application has an Admin and a User level, users can only view and edit record relating to their own account and Admins can view & edit all records (sounds easy but I am having some issues). I have installed this application on 3 subdomains and recently one of the installations is giving me problems, when an Admin tries to create a user account their own UserID is overwriting the new users UserID, and so I get the PHP 256 error, Duplicate entry for key 1. I am using the Advanced Security option "Users can see and edit their own data only" which is required to stop users seeing each others records, is there a better way to do this ? Could I create an event to only list records relating to the logged in user, unless they are an admin where they can see all records ? Any help appreciated <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=63211&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> And happy xmas to you all :-D |
C
|
crhys author 12/22/2011 |
Hi Chuck, |
C
|
crhys author 12/22/2011 |
Hi Again, |
C
|
crhys author 12/22/2011 |
I found a fix, its not perfect but I will work on it. |
C
|
chuckbower 12/22/2011 |
Chrys, Hi Again, Just fixed the code and it works <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=63215&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> Only little issue now is that the admin can only see his/her record as well... hmmmm Code: $strWhereClause = whereAdd($strWhereClause,"UserData.UserName ='".$_SESSION["UserID"]."'"); |