This topic is locked

Filtering data on login

2/25/2008 13:48:57
PHPRunner General questions
M
mmponline author

I've got a login table and use the new Dynamic Permissions. I've also setup a documents table with fields: DocID, Category, Title, Download.

The Category field has an Lookup showing the Group from my Login table. Thus Category = Group
I assigned users to specific groups in the admin area.
My need is the following:
Lets say user A is assigned to Group: Plant and IT.

User B is assigned to Group: Workshop and IT.

Usr C is assigned to Group: Yard

etc.
When user A logs in, he must see only the listings of entries containing a category of Plant and IT

When user B logs in, he must see only the listings of entries containing a category of Workshop and IT

When user C logs in, she must see only the listings of entries containing a category of Yard.

When a user's group assignments change, the viewable entries will thus also change.
Thus, all users will (on login) see the same table, but each will only see the entries "connected" to his group.

Note: All entries is added by an administrator (or even different users idf needed). Thus the viewable entries is on category=group and not on login ID.
Thanks for any guidance on this.

Sergey Kornilov admin 2/25/2008

Stephan,
I'm afraid you won't be able to use Dynamic Permissions in this case.
You can use BeforeSQL query event to add a dynamic where clause to the query based on logged user type.

M
mmponline author 2/26/2008

Thanks Sergey
Is it possible to help me with a sample code on this. I will obviously change the dynamic to normal, but if you can supply me with an example code code, it would be fantastic.

M
mmponline author 2/27/2008

Is it possible to help me with a sample code on this.

M
mmponline author 2/28/2008

Is it possible to help me with a sample code on this

J
Jane 2/28/2008

Hi,
here is a sample:

$strWhereClause = whereAdd($strWhereClause,"group_id=value1 and group_id=value2");


Select your value1 and value2 from table where these values are stored.