473,414 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Check group membership, the sequel

Hello there
IsInrole gives ya the means to check if the current or impersonated user
belongs to a specific windows role or group.
is there a way to do the same without using ADSI to check if "domain\user"
belongs to "domain\group"?
the reason is, when getting the "memberof" property of a user, then checking
if it contains the desired group or not.
this will only work if the user is a member of the group itself but not when
he is a member of a group that belongs to the designated group.
Do I make sense?
Regards
Sameh
Nov 21 '05 #1
7 5588
I still think you should be using WindowsPrincipal::IsInRole. What happened
when you tried the reflection code I suggested?

It is possible to do group membership expansion programmatically, but it
seems like it would be better to try and get the built in stuff that already
supports this working.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
Hello there
IsInrole gives ya the means to check if the current or impersonated user
belongs to a specific windows role or group.
is there a way to do the same without using ADSI to check if "domain\user"
belongs to "domain\group"?
the reason is, when getting the "memberof" property of a user, then
checking if it contains the desired group or not.
this will only work if the user is a member of the group itself but not
when he is a member of a group that belongs to the designated group.
Do I make sense?
Regards
Sameh

Nov 21 '05 #2
The code you sent worked very good.
and in a domain environment the isinrole worked also very well.
I use it to make the decision if the current user (running the application)
has the right to be using it or the application should quit.
So for this part, it was solved and everything work in a very good way.
within the functionality of the application, I need to take a decision on
how to handle users depending on their group memberships, IE if the
"domain\user" belongs to the group "domain\group" it should be dealt with in
the manner A, and if it belongs to the "domain\another group" it should be
handled in the manner B.
do I need to check if the user belongs to a certain group or not (explicitly
or implicitly by belonging to a group that is a member of the
"domain\group")
Hope I made myself clear on that one.
thanks again.
Regards
Sameh
"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com> wrote
in message news:%2******************@tk2msftngp13.phx.gbl...
I still think you should be using WindowsPrincipal::IsInRole. What
happened when you tried the reflection code I suggested?

It is possible to do group membership expansion programmatically, but it
seems like it would be better to try and get the built in stuff that
already supports this working.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
Hello there
IsInrole gives ya the means to check if the current or impersonated user
belongs to a specific windows role or group.
is there a way to do the same without using ADSI to check if
"domain\user" belongs to "domain\group"?
the reason is, when getting the "memberof" property of a user, then
checking if it contains the desired group or not.
this will only work if the user is a member of the group itself but not
when he is a member of a group that belongs to the designated group.
Do I make sense?
Regards
Sameh


Nov 21 '05 #3
IsInRole supports fully nested security group membership (assuming you are
on a 2000 native AD domain that supports nested groups). You don't have to
do anything extra to make this work.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
The code you sent worked very good.
and in a domain environment the isinrole worked also very well.
I use it to make the decision if the current user (running the
application) has the right to be using it or the application should quit.
So for this part, it was solved and everything work in a very good way.
within the functionality of the application, I need to take a decision on
how to handle users depending on their group memberships, IE if the
"domain\user" belongs to the group "domain\group" it should be dealt with
in the manner A, and if it belongs to the "domain\another group" it should
be handled in the manner B.
do I need to check if the user belongs to a certain group or not
(explicitly or implicitly by belonging to a group that is a member of the
"domain\group")
Hope I made myself clear on that one.
thanks again.
Regards
Sameh
"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com> wrote
in message news:%2******************@tk2msftngp13.phx.gbl...
I still think you should be using WindowsPrincipal::IsInRole. What
happened when you tried the reflection code I suggested?

It is possible to do group membership expansion programmatically, but it
seems like it would be better to try and get the built in stuff that
already supports this working.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
Hello there
IsInrole gives ya the means to check if the current or impersonated user
belongs to a specific windows role or group.
is there a way to do the same without using ADSI to check if
"domain\user" belongs to "domain\group"?
the reason is, when getting the "memberof" property of a user, then
checking if it contains the desired group or not.
this will only work if the user is a member of the group itself but not
when he is a member of a group that belongs to the designated group.
Do I make sense?
Regards
Sameh



Nov 21 '05 #4
I need to specify a different use the one used to run the code

"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com> wrote
in message news:u1**************@tk2msftngp13.phx.gbl...
IsInRole supports fully nested security group membership (assuming you are
on a 2000 native AD domain that supports nested groups). You don't have
to do anything extra to make this work.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
The code you sent worked very good.
and in a domain environment the isinrole worked also very well.
I use it to make the decision if the current user (running the
application) has the right to be using it or the application should quit.
So for this part, it was solved and everything work in a very good way.
within the functionality of the application, I need to take a decision on
how to handle users depending on their group memberships, IE if the
"domain\user" belongs to the group "domain\group" it should be dealt with
in the manner A, and if it belongs to the "domain\another group" it
should be handled in the manner B.
do I need to check if the user belongs to a certain group or not
(explicitly or implicitly by belonging to a group that is a member of the
"domain\group")
Hope I made myself clear on that one.
thanks again.
Regards
Sameh
"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com>
wrote in message news:%2******************@tk2msftngp13.phx.gbl...
I still think you should be using WindowsPrincipal::IsInRole. What
happened when you tried the reflection code I suggested?

It is possible to do group membership expansion programmatically, but it
seems like it would be better to try and get the built in stuff that
already supports this working.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
Hello there
IsInrole gives ya the means to check if the current or impersonated
user belongs to a specific windows role or group.
is there a way to do the same without using ADSI to check if
"domain\user" belongs to "domain\group"?
the reason is, when getting the "memberof" property of a user, then
checking if it contains the desired group or not.
this will only work if the user is a member of the group itself but not
when he is a member of a group that belongs to the designated group.
Do I make sense?
Regards
Sameh



Nov 21 '05 #5
So, you need to look up the group membership for a user that you don't have
a security token for? That is a little bit harder.

The absolute best way to deal with that situation is to use the protocol
transition (S4U) feature of Windows Server 2003 AD by creating a
WindowsIdentity for the use with their userPrincipalName. You don't need a
password for this. You get a lower privileged token, but you can still
create a WindowsPrincipal that can be used for role checks.

If you don't have a native mode 2003 AD, then this problem is harder to deal
with. You'll probably need to do some directory services code to do the
group membership expansion (although the AzMan APIs may be an option as
well). The secret with LDAP calls is to use the tokenGroups attribute which
is a calculated attribute that contains the fully expanded security group
membership for the object.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
I need to specify a different use the one used to run the code

"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com> wrote
in message news:u1**************@tk2msftngp13.phx.gbl...
IsInRole supports fully nested security group membership (assuming you
are on a 2000 native AD domain that supports nested groups). You don't
have to do anything extra to make this work.

Joe K.

Nov 21 '05 #6
unfortunately this is a 2000 Domain.
and tokenGroups on rarely mentioned on the MSDN, I will keep searching till
I get something useful on how to use that attribute.
Regards
Thanks Joe
"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com> wrote
in message news:O7**************@tk2msftngp13.phx.gbl...
So, you need to look up the group membership for a user that you don't
have a security token for? That is a little bit harder.

The absolute best way to deal with that situation is to use the protocol
transition (S4U) feature of Windows Server 2003 AD by creating a
WindowsIdentity for the use with their userPrincipalName. You don't need
a password for this. You get a lower privileged token, but you can still
create a WindowsPrincipal that can be used for role checks.

If you don't have a native mode 2003 AD, then this problem is harder to
deal with. You'll probably need to do some directory services code to do
the group membership expansion (although the AzMan APIs may be an option
as well). The secret with LDAP calls is to use the tokenGroups attribute
which is a calculated attribute that contains the fully expanded security
group membership for the object.

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
I need to specify a different use the one used to run the code

"Joe Kaplan (MVP - ADSI)" <jo*************@removethis.accenture.com>
wrote in message news:u1**************@tk2msftngp13.phx.gbl...
IsInRole supports fully nested security group membership (assuming you
are on a 2000 native AD domain that supports nested groups). You don't
have to do anything extra to make this work.

Joe K.


Nov 21 '05 #7
Here's a link to one S.DS sample I've posted. Google should turn up more
hits:

http://groups.google.com/groups?hl=e...TNGP12.phx.gbl

Joe K.

"Sameh Ahmed" <es******@hotmail.com> wrote in message
news:es****************@TK2MSFTNGP09.phx.gbl...
unfortunately this is a 2000 Domain.
and tokenGroups on rarely mentioned on the MSDN, I will keep searching
till I get something useful on how to use that attribute.
Regards
Thanks Joe

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Doanh Tran | last post by:
Hi all, Does anyone have any suggestion for converting a Sequel database to MYSQL? I just want to copy a Sequel database data to a Mysql one. Thanks in advance for any suggestion, Mike --
2
by: innesm | last post by:
Hi, Although I havent been able to find any documentation to confirm it, it looks like any change to a windows local group's membership is only reflected in the group editing UI (and the...
5
by: Ian | last post by:
Can anyone give me advice on migrating my Access backend to sequel server? I am sure there are discussion groups and documentation for this but don't know where to look. I am looking for answers...
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
0
by: Kevin Waltman | last post by:
I am writing a client/server application that is using Remoting across TCP/IP. It does not use IIS or ASP in anyway. What I am looking to do is take the users WindowsIndentity from the remote...
17
by: TC | last post by:
In the past I always regarded user/group security as fairly tight. It is tricky to implement, but once implemented properly, it can't be cracked except through a dedicated effort. Recently,...
2
by: Annie | last post by:
Hello guys, I have set the MEMBERSHIP, ROLEMANAGER and PROFILE in my config file as below. I just want to use my own sql server 2000 table instead of MSDB.
4
by: Paul.Pucciarelli | last post by:
So I have some 'groups' which 'users' can join. There is no enrollment limit on these 'groups'. How should I store the list of users enrolled in the group? I'd like to be able to quickly...
1
by: Troels Arvin | last post by:
Hello, Quoting http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/ com.ibm.db2.luw.sql.ref.doc/doc/r0000935.html : Group privileges are not considered for any table or view specified...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.