Is there any way to check GRANT VIEW DEFINITION ?

  • Follow


There is a request to grant privilege to a particular user for viewing 
stored procedure source code for all databases.

We searched the web and applied the following script:

USE master
GO
GRANT VIEW ANY DEFINITION TO User1

Is there any way to check the view definition has been granted ?  We 
have tried sp_helprotect for one of those databases but there is no 
action shown as VIEW DEFINITION.

Your advice is sought.

Thanks
0
Reply Patrick 3/9/2010 8:31:34 AM

Check out the sys.server_permissions catalog view.

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi



"Patrick" <Patrick@discussions.microsoft.com> wrote in message 
news:OzPYqM2vKHA.3408@TK2MSFTNGP06.phx.gbl...
> There is a request to grant privilege to a particular user for viewing 
> stored procedure source code for all databases.
>
> We searched the web and applied the following script:
>
> USE master
> GO
> GRANT VIEW ANY DEFINITION TO User1
>
> Is there any way to check the view definition has been granted ?  We have 
> tried sp_helprotect for one of those databases but there is no action 
> shown as VIEW DEFINITION.
>
> Your advice is sought.
>
> Thanks 

0
Reply Tibor 3/9/2010 10:40:56 AM


Hi Patrick

Something like:

SELECT 
[permission_name],
[state_desc],
[name]
FROM
sys.database_permissions AS prmssn
INNER JOIN sys.database_principals AS grantee_principal 
ON grantee_principal.principal_id = prmssn.grantee_principal_id
WHERE prmssn.class = 0

Jon

"Patrick" wrote:

> There is a request to grant privilege to a particular user for viewing 
> stored procedure source code for all databases.
> 
> We searched the web and applied the following script:
> 
> USE master
> GO
> GRANT VIEW ANY DEFINITION TO User1
> 
> Is there any way to check the view definition has been granted ?  We 
> have tried sp_helprotect for one of those databases but there is no 
> action shown as VIEW DEFINITION.
> 
> Your advice is sought.
> 
> Thanks
> .
> 
0
Reply Utf 3/9/2010 10:47:01 AM

I have double checked sp_helprotect and it is giving me a listing for View 
Definition as I would expect.

Jon

"jgurgul" wrote:

> Hi Patrick
> 
> Something like:
> 
> SELECT 
> [permission_name],
> [state_desc],
> [name]
> FROM
> sys.database_permissions AS prmssn
> INNER JOIN sys.database_principals AS grantee_principal 
> ON grantee_principal.principal_id = prmssn.grantee_principal_id
> WHERE prmssn.class = 0
> 
> Jon
> 
> "Patrick" wrote:
> 
> > There is a request to grant privilege to a particular user for viewing 
> > stored procedure source code for all databases.
> > 
> > We searched the web and applied the following script:
> > 
> > USE master
> > GO
> > GRANT VIEW ANY DEFINITION TO User1
> > 
> > Is there any way to check the view definition has been granted ?  We 
> > have tried sp_helprotect for one of those databases but there is no 
> > action shown as VIEW DEFINITION.
> > 
> > Your advice is sought.
> > 
> > Thanks
> > .
> > 
0
Reply Utf 3/9/2010 10:52:01 AM

Ahh server wide. :P

SELECT 
[permission_name],
[state_desc],
[name]
FROM
sys.server_permissions AS prmssn
INNER JOIN sys.server_principals AS grantee_principal ON 
grantee_principal.principal_id = prmssn.grantee_principal_id
WHERE
(prmssn.class = 100)

Jon

"jgurgul" wrote:

> I have double checked sp_helprotect and it is giving me a listing for View 
> Definition as I would expect.
> 
> Jon
> 
> "jgurgul" wrote:
> 
> > Hi Patrick
> > 
> > Something like:
> > 
> > SELECT 
> > [permission_name],
> > [state_desc],
> > [name]
> > FROM
> > sys.database_permissions AS prmssn
> > INNER JOIN sys.database_principals AS grantee_principal 
> > ON grantee_principal.principal_id = prmssn.grantee_principal_id
> > WHERE prmssn.class = 0
> > 
> > Jon
> > 
> > "Patrick" wrote:
> > 
> > > There is a request to grant privilege to a particular user for viewing 
> > > stored procedure source code for all databases.
> > > 
> > > We searched the web and applied the following script:
> > > 
> > > USE master
> > > GO
> > > GRANT VIEW ANY DEFINITION TO User1
> > > 
> > > Is there any way to check the view definition has been granted ?  We 
> > > have tried sp_helprotect for one of those databases but there is no 
> > > action shown as VIEW DEFINITION.
> > > 
> > > Your advice is sought.
> > > 
> > > Thanks
> > > .
> > > 
0
Reply Utf 3/9/2010 11:00:03 AM

Many thanks for your help.  Much appreciated.


On 9/03/2010 10:00 PM, jgurgul wrote:
> Ahh server wide. :P
>
> SELECT
> [permission_name],
> [state_desc],
> [name]
> FROM
> sys.server_permissions AS prmssn
> INNER JOIN sys.server_principals AS grantee_principal ON
> grantee_principal.principal_id = prmssn.grantee_principal_id
> WHERE
> (prmssn.class = 100)
>
> Jon
>
> "jgurgul" wrote:
>
>> I have double checked sp_helprotect and it is giving me a listing for View
>> Definition as I would expect.
>>
>> Jon
>>
>> "jgurgul" wrote:
>>
>>> Hi Patrick
>>>
>>> Something like:
>>>
>>> SELECT
>>> [permission_name],
>>> [state_desc],
>>> [name]
>>> FROM
>>> sys.database_permissions AS prmssn
>>> INNER JOIN sys.database_principals AS grantee_principal
>>> ON grantee_principal.principal_id = prmssn.grantee_principal_id
>>> WHERE prmssn.class = 0
>>>
>>> Jon
>>>
>>> "Patrick" wrote:
>>>
>>>> There is a request to grant privilege to a particular user for viewing
>>>> stored procedure source code for all databases.
>>>>
>>>> We searched the web and applied the following script:
>>>>
>>>> USE master
>>>> GO
>>>> GRANT VIEW ANY DEFINITION TO User1
>>>>
>>>> Is there any way to check the view definition has been granted ?  We
>>>> have tried sp_helprotect for one of those databases but there is no
>>>> action shown as VIEW DEFINITION.
>>>>
>>>> Your advice is sought.
>>>>
>>>> Thanks
>>>> .
>>>>

0
Reply Patrick 3/17/2010 10:23:23 AM

5 Replies
753 Views

(page loaded in 0.147 seconds)


Reply: