How to determine EXEC permission to an extended stored procedure?
From: Hal Heinrich (HalHeinrich_at_discussions.microsoft.com)
Date: 05/16/05
- Previous message: Hari Prasad: "Re: Retrieving ALL Object Privs for ALL Users in ALL Databases"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 16 May 2005 10:13:07 -0700
The following proc indicates whether you have EXEC permission to a proc -
however it fails for extended procs. I'd be grateful for a fix!
A good test is @SPNM = 'xp_sprintf'. Note that the proc is getting a valid
object id for the extended procs.
PROCEDURE procHasExecutePermission
( @SPNM sysname,
@HAS bit OUTPUT
) AS
BEGIN
SET NOCOUNT ON
DECLARE @OID int
SET @OID = OBJECT_ID(@SPNM)
IF @OID IS NULL
IF SUBSTRING(@SPNM, 1, 3) = 'sp_' OR SUBSTRING(@SPNM, 1, 3) = 'xp_'
SET @OID = OBJECT_ID('master..' + @SPNM)
IF @OID IS NULL
SET @HAS = 0
ELSE
IF PERMISSIONS(@OID) & 0x20 = 0x20
SET @HAS = 1
ELSE
SET @HAS = 0
END
Thanks in advance for your help,
Hal Heinrich VP Technology
Aralan Solutions Inc.
- Previous message: Hari Prasad: "Re: Retrieving ALL Object Privs for ALL Users in ALL Databases"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|