SQL 登录访问 ASP.Net 应用程序数据库的权限
我总是想知道我需要为 sql 登录提供哪些确切的访问权限和权限,我从 ASP.NET 应用程序中使用该登录来访问数据库。 应用程序执行一些存储过程,将数据插入、更新和删除到表中。 我也直接在表格上选择、删除、更新。 此外还有一些触发器。 想知道是否有权限矩阵的完整列表可以提供帮助。
I always wonder what are the exact access rights and permissions I need to give to a sql login which I use from my asp.net application to access database. The application execute some stored procedures which insert, update and delete data into tables. I do select, delete, update directly on the tables also. Also there are some triggers.
Wonder if there is a comprehensive list of the permission matrix to help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,这取决于您想要使其复杂程度:-)
最简单的解决方案:
至于执行存储过程,我们所做的是在数据库中创建一个新的自定义数据库角色“db_executor”,如下所示:
然后我们也将该角色授予 db 用户。 这个新的自定义数据库角色将对数据库中所有现有的和所有未来存储的过程/函数拥有执行权限。
这样,您的数据库用户就可以读取和写入任何表并执行任何存储过程和存储函数。
更复杂的解决方案:
当然,您也可以将单个表、视图、过程、函数的权限授予单个数据库用户和/或数据库角色。 但它可能会变得非常混乱和复杂。
马克
Well, it depends on how complicated you want to make it :-)
Simplest solution:
As for executing stored procs, what we did is create a new custom database role "db_executor" in our database like this:
and then we grant this role to the db user as well. This new custom database role will have execute rights on all existing AND on all future stored procs/funcs in your database.
With this, your db user can read and write any table and execute any stored proc and stored func.
More complex solution:
You can of course also GRANT permissions on individual tables, views, procs, funcs to inidividual db users and/or db roles. But it can get quite messy and complicated.
Marc