Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to implement User-Level security in app ?

Author  Topic 

hdv212
Posting Yak Master

140 Posts

Posted - 2009-04-17 : 06:24:59
Hi
i'm looking for any example or article about how to implement user-level security for mu application.
my app scenario is :
1. My app have some forms
2. Users & Roles can define in app
3. Each user must have a role
4. Each role must have it's security level (i want in my app, admin can select a role and give a appropriate right on selected objects(forms) to that role)
How to implement this ?

A Good Idea : if u familiar with SharePoint, u saw, even users can assign a permission just for an specific Item! but don't know how to that.

What table's are needed ?
What data store in each table ?
Which tables have relationship together ?


any other idea would be great appreciated.
Thanks

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-04-17 : 07:21:03
Tables needed:
Users
Roles - Admin, Basic, Data, Backup - etc
Permissions - Read, Write, Modify, Edit etc
Objects - a record for each of your forms
ObjectsPermissionsForRoles - Which Forms have which permissions for which roles. You can also specify a user column and leave the role column NULL which would mean that this permission applies only to a specific user.


There's also a .NET roles and membership engine built right on to the framework (if you're using .NET). You can use that, however, building your own provider might be better since it provides more control & flexibility. There's many ways to implement it, and the above is just one of the ways. The design above provides maximum control on each specific object. Instead of providing permissions for a role, it goes more detailed by providing permissions for a object for a role/user.

It is also possible to enable a dynamic compiled permission engine. The engine compiles itself based on the rules in the DB tables, this would improve performance (you could alternatively cache it as well).
Go to Top of Page

hdv212
Posting Yak Master

140 Posts

Posted - 2009-04-17 : 08:20:50
Thanks whitefang
i've review and do something like this, but i'm confusing about it's architecture. can u give me an example or article to explain this ?
Thanks
Go to Top of Page

whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-04-17 : 08:30:59
Read this http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_-and-Security-Resources-.aspx


Go to Top of Page

hdv212
Posting Yak Master

140 Posts

Posted - 2009-04-17 : 11:09:18
after a lot of search, i define some tables which represent in this image :
http://i44.tinypic.com/142v439.jpg

as u can see in that image, my tables are these :
Users : to define user
Roles : to define role
UserRoles : store relationship between Users and Roles (which user member of which role)
Rights : to define right (like Select,Insert,Update,Delete,Report, ...)
Objects : to hold all objects(can be include database objects or application objects) which must be assign security level to
Permissons : to hold which role on which object have which right.

and now, i want to display this form and table to user :
http://i42.tinypic.com/v75gzb.jpg

in the form, admin can select a role from comboBox and set appropriate permission to an specific object,
but i don't know how to query tables to display this table, and how to manage this data.
i think the database design is correct but getting query is main problem, i want to manage security levels like second image.

any help would be great appreciated.
Go to Top of Page

hdv212
Posting Yak Master

140 Posts

Posted - 2009-04-17 : 16:01:38
can anybody help me ?
It's very Emergency.
Go to Top of Page
   

- Advertisement -