Geekdojo

Tech people talking tech things
Welcome to Geekdojo Sign in | Join | Help
in Search

German Marin's Blog

Row level Security SQL

Microsoft provides a method to grant permisisons to individual columns within a table. Row-level security, however, is implemented using a "view", a stored proc, or SQL function. The method I most commonly see is using a SQL view--it's a lot easier than trying to manage column permissions. Instead, you grant SQL permissions to the view, not the underlying table. With creative use of a WHERE clause, you should only need one "view" for every type of database access. For example, a customer service rep viewing his/her trouble tickets can be accomplished by creating a view that filters the TroubleTicket database for tickets WHERE AgentName = SUSER_NAME(), a built-in SQL function that returns the currently logged-in username. This ensures that all actions taken using the view will only affect tickets for that agent. Deny permissions to all the tables and only grant your users permissions to the views.

Referencias

http://vyaskn.tripod.com/row_level_security_in_sql_server_databases.htm

I think It's a better idea to use SUSER_SID()  instead of SUSER_NAME(). What do you think???

Published Monday, May 09, 2005 1:34 PM by german

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

What do you think?

(required) 
(optional)
(required) 

This Blog

Post Calendar

<May 2005>
SuMoTuWeThFrSa
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

Syndication

Powered by Community Server, by Telligent Systems