473,804 Members | 4,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Ena bled = wp.IsInRole(@"d omain\ibb*"); or
mnuPlanning.Ena bled = wp.IsInRole(@"d omain\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 2454
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.co m

"Esteban404 " <Es********@dis cussions.micros oft.com> wrote in message
news:45******** *************** ***********@mic rosoft.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.Ena bled = wp.IsInRole(@"d omain\ibb*"); or
mnuPlanning.Ena bled = wp.IsInRole(@"d omain\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.co m

"Esteban404 " <Es********@dis cussions.micros oft.com> wrote in message
news:45******** *************** ***********@mic rosoft.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.Ena bled = wp.IsInRole(@"d omain\ibb*"); or
mnuPlanning.Ena bled = wp.IsInRole(@"d omain\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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1727
by: Steve T | last post by:
I have just contracted with a firm that is using a front-end web interface to access our sales data. They developed it with Microsoft Dotnet, and it uses Microsoft SQL as the database. When I search test/note fields, they say I have to do a wild card search *word* to pull up any records with "word" in that field. With our previous vendor, and with many other web accessable data bases I search you usually do not need the wild cards,...
3
2397
by: topmind | last post by:
I need to search for database text with underlines in it. However, underlines are interpreted as wild-cards in LIKE clause text . I need to know how to escape the underlines so as to be able to search them. Some DB's use an "Escape" keyword and others use a back-slash to escape wild-cards. However, Jet does not seem to support either of these. Note that I am accessing Access files via ODBC and ADO (or is it DAO?) and not through Access...
8
13158
by: Oliver Rainer | last post by:
Hi, I have the following problem... Pre-requisites: Installation of an Asp.net webservice on a IIS5 server (win2k). Anonymous access is not allowed, only using windows authentication (intranet app), webmethoda are using the Principalpermssion attribute () for identification. Result --> does not work
4
4427
by: Bob | last post by:
I created a usergroup on my W2K AD domain server and called it MyCustomRole I added my user to it named User Name fully qualified is Mydomain\Bob I can see that My.user.name Is OK its Mydomain\Bob But when I run the line If My.User.IsInRole("MyCustomRole") Then it returns false.
10
7038
by: Bob | last post by:
This a bit of a second post on same subject, my apologies. IsinRole function only works with built-in roles. If I create a new group on my domain controller then add an existing user to that group, user bob, group TestUsers and then try to determine if My.user.Isinrole("TestUsers") I always get a false, which is incorrect. If I put Bob as part of Administrators or any other built-in group on the DC and look at...
1
2768
by: panchaga | last post by:
Hi, could any one help me with this select statement. i am using as part of JSP page. i want to use wild cards as part of this select. i am getting error when i use % along with the name. rs = statement.executeQuery("SELECT * FROM lessons WHERE fname='"+ name+ "'"); Thanks
4
5201
by: MattWilson.6185 | last post by:
Hi, I was wondering if there is any type of way to specify a generic type for a list. I basicaly have class shape { } class circle: public shape { }; class triangle: public shape {
1
1877
by: Nitinkcv | last post by:
Hi, I have a textbox and a button. In my textbox i have to enter the query string(say shoes) and on clicking the button takes me to a page show all item related to the search string( in this case shoes). But on mixing the search string with wildcards it displays that no items could be found. For eg: for search string s@h^o$e@s it would go to the error page. So is there ant way i could like extract the wildcards out of my search string...
7
9262
by: W. eWatson | last post by:
Is it possible to do a search for a wild card string in another string. For example, I'd like to find "v*.dat" in a string called bingo. v must be matched against only the first character in bingo, and not simply found somewhere in bingo, as might be the case for "*v*.dat". -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.