473,804 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine NT groups if in hierarchy?

We have setup 4 NT groups - Executive, Manager, Employee and
Contractor. The premise is that an Executive has all of the privileges
of Itself plus Manager plus Employee plus Contractor while an Employee
only has itself and Contractor.

We did this as a hierarchy where the higher (i.e. Executive) has a
member of the one directly below (i.e. Manager):

Executive has a member of Manager
Manager has a member of Employee
Employee has a member of Contractor
Contractor

Using .NET 2.0 we are using Page.User.Ident ity.Name to determine the
user and from there can determine the NT groups in which they belong by
using the following:

// Display the SIDs for the groups the current user belongs.
Response.Write( "<br>Displa y the SIDs for the groups the current user
belongs");
WindowsIdentity wi = User.Identity as WindowsIdentity ;
Response.Write( "<br>");
Response.Write( "Is Authenticated=" + wi.IsAuthentica ted);
Response.Write( "<br>");
// Display the SID for the owner.
Response.Write( "The SID for the owner is : ");
SecurityIdentif ier si = wi.Owner;
Response.Write( si.ToString());
StringCollectio n roles = new StringCollectio n();
foreach (IdentityRefere nce group in wi.Groups)
{
Response.Write( "<br>" + group.Value);
string role =
((NTAccount)gro up.Translate(ty peof(NTAccount) )).Value;
Response.Write( " - " + role.ToString() );
}

If I set myself up in the Manager group and run the code above I see
that I'm a member of the Manager group. The problem is that I need to
check to make sure I'm a member of the Employee group but how would I
go about doing this? Do I write code that somehow traverses the groups
or will NT handle this? Since theoretically if I'm a member of the
Manager then if we setup the groups correctly I should also be a member
of Employee and Contractor. We're attempting Impersonation/Delegation
against a database.
Thanks,
Gary

Dec 6 '06 #1
2 1913
OHM
Easy to test. Set youself up as a member of the emloyees group and then if
this is a member of the managers group,. If NT were to apply its
hierarchical membership method you would be a member of managers by default.
However, I dont think ( and I may be wrong ) that this works in this fashion
for the purposes of ASP.NET I would be interested to try that though.

Post back and let us know how you got on

--

Best Regards - OHM

http://TrainingOn.net
--------------------------------------------------
<ga***********@ gmail.comwrote in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
We have setup 4 NT groups - Executive, Manager, Employee and
Contractor. The premise is that an Executive has all of the privileges
of Itself plus Manager plus Employee plus Contractor while an Employee
only has itself and Contractor.

We did this as a hierarchy where the higher (i.e. Executive) has a
member of the one directly below (i.e. Manager):

Executive has a member of Manager
Manager has a member of Employee
Employee has a member of Contractor
Contractor

Using .NET 2.0 we are using Page.User.Ident ity.Name to determine the
user and from there can determine the NT groups in which they belong by
using the following:

// Display the SIDs for the groups the current user belongs.
Response.Write( "<br>Displa y the SIDs for the groups the current user
belongs");
WindowsIdentity wi = User.Identity as WindowsIdentity ;
Response.Write( "<br>");
Response.Write( "Is Authenticated=" + wi.IsAuthentica ted);
Response.Write( "<br>");
// Display the SID for the owner.
Response.Write( "The SID for the owner is : ");
SecurityIdentif ier si = wi.Owner;
Response.Write( si.ToString());
StringCollectio n roles = new StringCollectio n();
foreach (IdentityRefere nce group in wi.Groups)
{
Response.Write( "<br>" + group.Value);
string role =
((NTAccount)gro up.Translate(ty peof(NTAccount) )).Value;
Response.Write( " - " + role.ToString() );
}

If I set myself up in the Manager group and run the code above I see
that I'm a member of the Manager group. The problem is that I need to
check to make sure I'm a member of the Employee group but how would I
go about doing this? Do I write code that somehow traverses the groups
or will NT handle this? Since theoretically if I'm a member of the
Manager then if we setup the groups correctly I should also be a member
of Employee and Contractor. We're attempting Impersonation/Delegation
against a database.
Thanks,
Gary

Dec 11 '06 #2
It actually worked! NT traversed the the groups and displayed all of
the member groups.

Gary

OHM wrote:
Easy to test. Set youself up as a member of the emloyees group and then if
this is a member of the managers group,. If NT were to apply its
hierarchical membership method you would be a member of managers by default.
However, I dont think ( and I may be wrong ) that this works in this fashion
for the purposes of ASP.NET I would be interested to try that though.

Post back and let us know how you got on

--

Best Regards - OHM

http://TrainingOn.net
--------------------------------------------------
<ga***********@ gmail.comwrote in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
We have setup 4 NT groups - Executive, Manager, Employee and
Contractor. The premise is that an Executive has all of the privileges
of Itself plus Manager plus Employee plus Contractor while an Employee
only has itself and Contractor.

We did this as a hierarchy where the higher (i.e. Executive) has a
member of the one directly below (i.e. Manager):

Executive has a member of Manager
Manager has a member of Employee
Employee has a member of Contractor
Contractor

Using .NET 2.0 we are using Page.User.Ident ity.Name to determine the
user and from there can determine the NT groups in which they belong by
using the following:

// Display the SIDs for the groups the current user belongs.
Response.Write( "<br>Displa y the SIDs for the groups the current user
belongs");
WindowsIdentity wi = User.Identity as WindowsIdentity ;
Response.Write( "<br>");
Response.Write( "Is Authenticated=" + wi.IsAuthentica ted);
Response.Write( "<br>");
// Display the SID for the owner.
Response.Write( "The SID for the owner is : ");
SecurityIdentif ier si = wi.Owner;
Response.Write( si.ToString());
StringCollectio n roles = new StringCollectio n();
foreach (IdentityRefere nce group in wi.Groups)
{
Response.Write( "<br>" + group.Value);
string role =
((NTAccount)gro up.Translate(ty peof(NTAccount) )).Value;
Response.Write( " - " + role.ToString() );
}

If I set myself up in the Manager group and run the code above I see
that I'm a member of the Manager group. The problem is that I need to
check to make sure I'm a member of the Employee group but how would I
go about doing this? Do I write code that somehow traverses the groups
or will NT handle this? Since theoretically if I'm a member of the
Manager then if we setup the groups correctly I should also be a member
of Employee and Contractor. We're attempting Impersonation/Delegation
against a database.
Thanks,
Gary
Dec 13 '06 #3

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

Similar topics

9
2761
by: Lenard Lindstrom | last post by:
I was wondering if anyone has suggested having Python determine a method's kind from its first parameter. 'self' is a de facto reserved word; 'cls' is a good indicator of a class method ( __new__ is a special case ). The closest to this I could find was the 2002-12-04 posting 'metaclasses and static methods' by Michele Simionato. The posting's example metaclass uses the method's name. I present my own example of automatic method kind...
21
11007
by: yer.lys | last post by:
When I print my web page the background image shrinks severly when I print from Firefox, but when I print in IE it cuts it like I would expect it to. Is this a bug or is there a mistake in my code somewhere? <--------------------------MY CODE-----------------------------> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">...
5
1738
by: Victor | last post by:
With Yahoo's support being non-existent, and with more and more ISPs (and countries) blocking Yahoo Group's IP addresses, I'm looking for a replacement for Yahoo Groups. Does anyone know of an ASP (VBScript) that can function as a Yahoo Group style replacement? This includes handling digest emails as well. All the popular forum software I've looked at, such as Snitz, can't handle it.
4
3537
by: FraterQ | last post by:
Hello, after i've read this post, i tried it myself and it works. http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=9jjh9m%247bb%242%40oravannahka.helsinki.fi&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3Dutf-8%26q%3Dresize%2Barray%2Bc%2Brealloc%26btnG%3DGoogle%2BSearch But I've the following problem: I can't determine the size of the dynamical generated array through a predefined function like sizeof(). Can...
2
28810
by: Liam McNamara | last post by:
I am having the same problem as the one I found in google below: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=%23LO32NWECHA.1968%40tkmsftngp02&rnum=3&prev=/groups%3Fq%3Dc%2523%2Bwhich%2Bcontrol%2Bhas%2Bfocus%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D%2523LO32NWECHA.1968%2540tkmsftngp02%26rnum%3D3 I need to determine which component has focus. When I select from the main menu File->Save my validation is...
14
24438
by: J. Jones | last post by:
Suppose the following: class MyContainer : System.Collections.CollectionBase { //... } (where CollectionBase implements IList, ICollection) How do I determine if a type (such as MyContainer) derives from IList?
1
1372
by: Chris Ashley | last post by:
I'm trying to use a treeview control for navigation in an app. How do I determine which node has been selected? I can't use the text property because some nodes have the same name, and the index property returns the index of the node but not where it is in the hierarchy. How else can I determine which nod was selected?
3
11592
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the content I want to execute based on the name of the asp:Content control. As shown in the code snippet below, to get the content I want to display, I call the GetContentPagePath public method in PageRenderer passing a string duplicating the value...
3
13261
by: Giampaolo Rodola' | last post by:
Hi, I'd like to know if there's a way to determine which is the best buffer size to use when you have to send() and recv() some data over the network. I have an FTP server application which, on data channel, uses 8192 bytes as buffer for both incoming and outgoing data. Some time ago I received a report from a guy who stated that changing the buffers from 8192 to 4096 results in a drastical speed improvement. I tried to make some tests...
0
9711
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
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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
10335
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
9169
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...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4306
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.