Monday, March 12, 2012

how to list perissions

Hi
I use C# cod and a have a problem with listing all premisions on some
user
please help
ciaoBoko
Some times ago Aaron ( If I remember well) answered the same question
CREATE FUNCTION dbo.RoleCheckUser
(
@.UserName sysname,
@.RoleName sysname
)
RETURNS BIT
AS
BEGIN
DECLARE @.RetVal BIT
SET @.RetVal = 0
SELECT @.RetVal = 1
WHERE EXISTS
(
SELECT *
FROM sysmembers membs
JOIN sysusers users on membs.memberuid = users.uid
JOIN sysusers groups on membs.groupuid = groups.uid
WHERE
users.name = @.UserName
AND groups.name = @.RoleName
)
RETURN @.RetVal
END
GO
-- Syntax to use the created function
SELECT dbo.RoleCheckUser('dbo', 'db_owner')
GO
"Boko" <borcecif@.yahoo.com> wrote in message
news:1141124678.068438.60580@.e56g2000cwe.googlegroups.com...
> Hi
> I use C# cod and a have a problem with listing all premisions on some
> user
> please help
> ciao
>

No comments:

Post a Comment