CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Record level security - restricting user access to own records while giving admin acces to all

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.