Give access to Item on a SQL Server table

  • I am designing an application where multiple users can be assign to a product for review. If a user doesn't have access to the product, they are not allowed to see it. I have attached my table design. I will appreciate if some one can let me know if it is correct. All users are assign to a role. See attached screen

  • I am designing an application where multiple users can be assign to a product for review. If a user doesn't have access to the product, they are not allowed to see it.

    You would probably have to create a view to do that... here's a quick article on getting the logged in user's username:

    http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/

    Then you could do something like this:

    CREATE VIEW <viewname> AS

    SELECT {fieldlist}

    FROM MyTable

    WHERE LoggedInUser = SUSER_NAME();

    Either that or you'd create stored procedures to do the CRUD stuff for you. Gives you MUCH better control, and you don't have to grant the user access to the underlying table(s).

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply