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:
- is correct approach? feels bit off reason. idea based off of this:
- 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.
Comments
Post a Comment