Forums: Limiting User Access - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Limiting User Access How do I limit User Access Levels Rate Topic: -----

#1 User is offline   wypman 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 33
  • Joined: 10-June 08

Posted 08 February 2010 - 11:57 PM

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?
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8041
  • Joined: 03-February 03

Posted 09 February 2010 - 02:46 AM

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
Best regards,
Sergey Kornilov
0

#3 User is offline   Mark K 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 09-February 10

Posted 09 February 2010 - 07:39 PM

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

#4 User is offline   Mark K 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 09-February 10

Posted 09 February 2010 - 07:57 PM

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

#5 User is offline   wypman 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 33
  • Joined: 10-June 08

Posted 10 February 2010 - 10:47 PM

View Postadmin, on 09 February 2010 - 02:46 AM, said:

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!
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users