469,364 Members | 2,332 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

IsInRole with wild cards?

My WinForm application is activating menus based on the user's roles in AD.
I've created the groups to use the same 3 letter abbreviation. Is there a way
to do something like this:

mnuPlanning.Enabled = wp.IsInRole(@"domain\ibb*"); or
mnuPlanning.Enabled = wp.IsInRole(@"domain\ibb%");

I'm using all possible groups in an if statement now, but would like to
consolidate it as much as possible.

Thanks,

_E
Nov 17 '05 #1
2 2231
Esteban404,

With the principal class you are using, no, it isn't possible.

What you should do is consolidate this into a function which will take
the principal, and your wildcard specification, and iterate through all the
known roles, checking to see that they are in at least one of the roles.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Esteban404" <Es********@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
My WinForm application is activating menus based on the user's roles in
AD.
I've created the groups to use the same 3 letter abbreviation. Is there a
way
to do something like this:

mnuPlanning.Enabled = wp.IsInRole(@"domain\ibb*"); or
mnuPlanning.Enabled = wp.IsInRole(@"domain\ibb%");

I'm using all possible groups in an if statement now, but would like to
consolidate it as much as possible.

Thanks,

_E

Nov 17 '05 #2
I've just started the MDI forms for the app so I haven't seen it used more
than once or I may have thought to do that. Too easy, so I didn't see it.
D'oh! I'm probably preoccupied with the 70-320 exam I'm taking tomorrow and
the possibility of great-granchild collections in the application. Time for a
break!

Thanks, Nicholas.

_E

"Nicholas Paldino [.NET/C# MVP]" wrote:
Esteban404,

With the principal class you are using, no, it isn't possible.

What you should do is consolidate this into a function which will take
the principal, and your wildcard specification, and iterate through all the
known roles, checking to see that they are in at least one of the roles.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Esteban404" <Es********@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
My WinForm application is activating menus based on the user's roles in
AD.
I've created the groups to use the same 3 letter abbreviation. Is there a
way
to do something like this:

mnuPlanning.Enabled = wp.IsInRole(@"domain\ibb*"); or
mnuPlanning.Enabled = wp.IsInRole(@"domain\ibb%");

I'm using all possible groups in an if statement now, but would like to
consolidate it as much as possible.

Thanks,

_E


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steve T | last post: by
8 posts views Thread by Oliver Rainer | last post: by
4 posts views Thread by Bob | last post: by
4 posts views Thread by MattWilson.6185 | last post: by
7 posts views Thread by W. eWatson | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.