This topic is locked

Limiting User Access

2/8/2010 6:57:33 PM
PHPRunner General questions
W
wypman author

I have a User table in which Users are given an Access Level Between 1 to 5. These levels correspond to levels in another table. It it possible to limit a user whose access level is 3 to only see the entries in the other table which contain access level of 3 or less and for person with an access level of say 4 so they can see all records values 4 and below i.e. 4, 3, 2 and 1?

Sergey Kornilov admin 2/8/2010

Two step process

  1. Use AfterSuccessfulLogin event to save access level in session variable

$_SESSION["level"] = $data["AccessLevel"];


2. Use BeforeSQLQuery event to modify WHERE clause:

$strWhereClause = whereAdd($strWhereClause, "AccessLevel >= " . $_SESSION["level"]);


More info:

http://xlinesoft.com/phprunner/docs/save_user_data_in_session_variables.htm

http://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm

M
mark@superience.com 2/9/2010

I have done this in the past with normal pages and charts, but what event do you use with reports?

M
mark@superience.com 2/9/2010

Never mind, I just upgraded to 5.2 and all is well in the world.

W
wypman author 2/10/2010



Two step process

  1. Use AfterSuccessfulLogin event to save access level in session variable

$_SESSION["level"] = $data["AccessLevel"];


2. Use BeforeSQLQuery event to modify WHERE clause:

$strWhereClause = whereAdd($strWhereClause, "AccessLevel >= " . $_SESSION["level"]);


More info:

http://xlinesoft.com...n_variables.htm

http://xlinesoft.com..._on_the_fly.htm


Thank you for that. Tried it on version 5.2 and its working great thank you!