Re: How to determine if a user has a permission programmatically?



In SQL Server 2005, you can use the has_perms_by_name
function to check the current users effective permissions on
securable.
http://msdn2.microsoft.com/en-us/library/ms189802.aspx

-Sue

On Mon, 11 Dec 2006 15:36:43 -0800, "Alek"
<alekDOTdavisATintelDOTcom> wrote:

Hi,

I need to determine in advance if a user logged on to SQL Server 2005 can
execute certain privileged stored procedures and statements (such as
sp_addrolemember and ALTER LOGIN). To do this, I though I would need to
determine programmatically if a user has specific permissions (ALTER ANY
LOGIN, ALTER ANY CREDENTIAL, CONTROL SERVER, ALTER ANY USER, CREATE ROLE,
ALTER ANY ROLE).

Is there a way to perform this check programmatically via T-SQL? If this can
be done programmatically, is there a way to determine if a permission is
implied implicitly if it is not set up explicitly (e.g. via a group the user
belongs to, such as BUILTIN\Administrators)? Is there a better approach to
make the check?

Thanks,
Alek


.



Relevant Pages

  • How to determine if a user has a permission programmatically?
    ... I need to determine in advance if a user logged on to SQL Server 2005 can ... sp_addrolemember and ALTER LOGIN). ... determine programmatically if a user has specific permissions (ALTER ANY ...
    (microsoft.public.sqlserver.security)
  • Re: How to determine if a user has a permission programmatically?
    ... SQL Service Broker ... sp_addrolemember and ALTER LOGIN). ... determine programmatically if a user has specific permissions (ALTER ANY ...
    (microsoft.public.sqlserver.security)
  • Re: How to determine if a user has a permission programmatically?
    ... SQL Service Broker ... sp_addrolemember and ALTER LOGIN). ... determine programmatically if a user has specific permissions (ALTER ANY ...
    (microsoft.public.sqlserver.security)
  • Excel Front End for SQL Server
    ... I'm having no problem using SQL to retrieve records from my SQL Server. ... However I cannot delete records in my SQL Server from Excel. ... permissions issue, but I'm not sure how to alter the permissions or which ... permissions to alter. ...
    (microsoft.public.excel.programming)
  • Re: Alter login issue
    ... I opened a request for updating the permissions section of ALTER LOGIN. ... users tried to change their details on our new SQL Server 2005 Server) ...
    (microsoft.public.sqlserver.security)