asp.net - SQL Limiting read and write to certain views -


i have database each user can create account , save user specific details. naturally, want each user able modify things linked account.

my strategy create sql login , user each account, create view each table can have access , grant them execute on few procedures.

the views created this:

using (var cmd = new sqlcommand("create view [<viewname>] select * <tablename> profileid = '" + <userid> + "'", con)) {     cmd.executenonquery();        } 

i tested view , found user would see/select items linked id problem when tried execute procedure using users id, user able modify data not in view; data "belongs" user.

so questions are:

  1. is correct approach? feels bit off reason. idea based off of this:

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server

  1. how can make sure users can edit rows contained in view? have deny user before grant him views , executes?

thank you.

this not correct approach.

asp.net website uses sql login has full read/write access whole database (or @ least part of database used application).

mind not mean users on website can data. web user not sql login, web user has access functions write , allow him run. need limit users' access in asp.net controller's code, checking permission before executing select or update in (c#, vb.net) code.

here an example how should done.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -