Friday, March 30, 2012

Is user allowed?

I thought this would be easy, but it's now seeming way more complex - so I'm
hoping someone has a shortcut.
How can you figure out if a User_Name is allowed in a specific role? Ok,
sounds easy at first, but what roles that that role is a sub-role of?
That's where it's gotten more complex than I thought --
So, pretend that we've got MasterRole of which BabyRole is a member. MyUser
is a member of BabyRole. And since BabyRole is a member of MasterRole,
MyUser is allowed to do all the things that MasterRoll can do. However if I
run sp_helplogins on MyUser, it will list BabyRole but not MasterRole. Is
there any sp or easy code that can enumerate all those roles (or even
better, is there any sp that I can call with a role name and a user and it
returns if the user is allowed in that role?)
TIA!Duhhh.. Ok, I found the command IS_MEMBER... I feel dummmbbb... Sorry to
waste the bandwidth :)
"Brett Wickard" <brettwickard@.nospam.nospam> wrote in message
news:OX7xqibfGHA.4828@.TK2MSFTNGP05.phx.gbl...
>I thought this would be easy, but it's now seeming way more complex - so
>I'm hoping someone has a shortcut.
> How can you figure out if a User_Name is allowed in a specific role? Ok,
> sounds easy at first, but what roles that that role is a sub-role of?
> That's where it's gotten more complex than I thought --
> So, pretend that we've got MasterRole of which BabyRole is a member.
> MyUser is a member of BabyRole. And since BabyRole is a member of
> MasterRole, MyUser is allowed to do all the things that MasterRoll can do.
> However if I run sp_helplogins on MyUser, it will list BabyRole but not
> MasterRole. Is there any sp or easy code that can enumerate all those
> roles (or even better, is there any sp that I can call with a role name
> and a user and it returns if the user is allowed in that role?)
> TIA!
>
>sql

No comments:

Post a Comment