Hi All,
How can I know if a user has UNSAFE ASSEMBLY permission on master database by executing query.
Please assist its really urgent, as I m stuck on this.
See SQL Server 2005 Books Online:
ALTER ASSEMBLY (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms186711.aspx
Creating an Assembly
http://msdn2.microsoft.com/en-us/library/ms345106.aspx
Users don’t have UNSAFE ASSEMBLY permission on master database but maybe you are looking for this:
SELECT pr.name
FROM sys.server_principals pr
INNER JOIN sys.server_permissions pe
ON pr.principal_id = pe.grantee_principal_id
WHERE pe.permission_name = 'EXTERNAL ACCESS ASSEMBLY'
If you want to change permision on as assembly:
To alter an assembly whose existing permission set is UNSAFE requires membership in the sysadmin fixed server role.
To change the permission set of an assembly to UNSAFE requires membership in the sysadmin fixed server role.
If you are creating assemblies:
We recommend that the TRUSTWORTHY Database Property on a database not be set to ON only to run common language runtime (CLR) code in the server process. Instead, we recommend that an asymmetric key be created from the assembly file in the master database. A login mapped to this asymmetric key must then be created, and the login must be granted EXTERNAL ACCESS ASSEMBLY or UNSAFE ASSEMBLY permission.
USE master GOCREATE ASYMMETRIC KEY SQLCLRTestKey FROM EXECUTABLE FILE = 'C:\MyDBApp\SQLCLRTest.dll'CREATE LOGIN SQLCLRTestLogin FROM ASYMMETRIC KEY SQLCLRTestKeyGRANT EXTERNAL ACCESS ASSEMBLY TO SQLCLRTestLogin GO
|||
Hey Ikh,
Truly speaking, I m not finding words to thank you.
Your reply is exactly what I was looking for.
Thank you very …………………… much .
Actually the scenario at my end is that. In our project we have used an Assembly with UNSAFE Permissions. Now before installing the product we need to check whether the user has permissions to Access the UNSAFE ASSEMBLY.
Your reply is the exact answer to my question
Thanks again for spending time in replying to me.
Have a good time ahead!
No comments:
Post a Comment