Gene
Posts: 14
|
| Posted: 05/18/2005, 3:18 PM |
|
I have an expense report component I am developing in CCS/ASP.
The business requirement is that managers should be able to view all records submitted by employees, but non-managers should never see any records save for the ones they created.
I am inserting the value of the UserID session variable into the record, which allows me to accomplish user-level privacy. I just need to figure out the most efficient way to use the content of the GroupID session variable to override the UserID if the logged in user has admin-level access. Essentially, a conditional WHERE clause.
I could create another set of screens that are restricted to admins only, and leave out the UserID constraint in the WHERE clause, but thats inefficient and redundant.
Any assistance is much appreciated!
Thanks
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 05/18/2005, 4:02 PM |
|
This is simple.
In your grid's query builde where clause, use the parenthesis to group
together:
Useridfield = Expression CCGetUserID() OR
Expression CCGetGroupID() = Expression value for the Admin Group Level
OR ....
You can use the BeforeBuildSelect embed. I use this extensively to
dynamically build where clauses based on checkbox statuses, for example,
where the checkbox value does not map one-one to a field in the database.
|
|
|
 |
Gene
Posts: 14
|
| Posted: 05/18/2005, 4:30 PM |
|
Yep. That's perfect. Thanks Benjamin.
Gene
|
 |
 |
|