向用户提供用户权限,仅访问1个视图 [英] Providing User Rights to User, to access only 1 View

查看:57
本文介绍了向用户提供用户权限,仅访问1个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我需要SQL用户的帮助,我需要创建1个视图并将其暴露给第三方应用程序。



我已经创建了SQL视图,并且还使用'select Grant'语句创建了User并提供了所需的权限。



但问题是,当我通过这个用户连接SQL管理工作室时,我看不到表(那很好)我只能看到视图。但是当我运行查询'select * from(table name)'时它会提供结果。



我如何提供安全用户,以便ResUser没有访问特定视图以外的任何权限。



请帮助。在此先感谢。



PS我是SQL的新手,所以请善待:)

Dear Friends,

I need help with SQL User, I need to create 1 view and expose it for 3rd party application.

I have already created SQL view, and have also created User and provide the required permissions using 'select Grant ' statement.

But the problem is that when i connect SQL management studio through this user, i can't see tables (thats good) i can see only view. but when i run query ' select * from (table name)' it provides the result.

How can i provide secure user, so that the ResUser doesn't have any permissions other then accessing the particular view.

Please help. Thanks in advance.

P.S I am new to SQL, so please be kind :)

推荐答案

看来你没有以正确的方式完成它,否则它必须工作,

请尝试以下脚本



It seems that you haven't done it in a right way otherwise it must work,
please try the following scripts

USE [master]
GO
CREATE LOGIN [SomeTestUser] WITH PASSWORD=N'TestPAss', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [YourDatabase]
GO
CREATE USER [SomeTestUser] FOR LOGIN [SomeTestUser]
GO





和仅允许选择



and for giving permission for only select

USE YourDatabase
GO


GRANT SELECT ON YourView TO SomeTestUser



<如果用户想要的话,请按照以下方式进行
在其他表中,它将收到以下错误:





by following the way if the user wants to select other tables it will receive the following error :

The SELECT permission was denied on the object 





更多信息



http://www.blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/giving-only-insert-permissions -to / [ ^ ]


这篇关于向用户提供用户权限,仅访问1个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆