This topic is locked

Advanced selection on list - BeforeProcessRowList

1/21/2015 1:06:05 PM
PHPRunner General questions
V
veca author

I have a list, where the user only may see the records where he/she has authority for.
Therefore I added some code in the "BeforeProcessRowList"
----

$docId = $data['doId'];

$userId = $_SESSION["userid"];
$auth = DBS::GetDocAuth($docId, $userId);
if ($auth == '*FULL')

return true;

else

return false;
---
The rows are indeed omitted, but the pagination is completely wrong (blank pages, other pages with only 1 record, ...)
Do I have to use an other event?

lefty 1/22/2015



I have a list, where the user only may see the records where he/she has authority for.
Therefore I added some code in the "BeforeProcessRowList"
----

$docId = $data['doId'];

$userId = $_SESSION["userid"];
$auth = DBS::GetDocAuth($docId, $userId);
if ($auth == '*FULL')

return true;

else

return false;
---
The rows are indeed omitted, but the pagination is completely wrong (blank pages, other pages with only 1 record, ...)
Do I have to use an other event?



Actullay no but it is so much easier to setup advanced security with groups ::::
Depends on the authority field . If you have one . setup advanced security settings in phprunner and then go to security settings and look at : authority field ( if you don't have one create one ) and match it with userid ; go to the security tab of that table and use (users can see and edit only their own records and use : users table :userid : Main Table : authority table : authority field. That will only show records that are setup on authority field that match the userid . Now if the user did not add that record and administrator did then , that field that matches the userid must match the authority field. So on admin security table ; need group for admin to see all records and group for users that can only see add/edit list print fields. of their own records . If you don't want them to add/edit records just check the group of users for list page.
This may seem a lot of work but now you can use this in all tables .

V
veca author 1/22/2015

Thanks for the reply.
But I have 2 major problems with your solution

  1. I don't use the PHPrunner login-screen (My PHPrunner apps are embedded in a website with its own login security)
  2. The authority rules are a lot more complex than just checking the user-id with the one who created the record. Otherwise I could simply change the where-clause in the "BeforeQueryList" event