The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
WindowsBuiltInRole Enumeration
.NET Framework 2.0
Specifies common roles to be used with IsInRole.
Namespace: System.Security.Principal
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
| Member name | Description | |
|---|---|---|
| AccountOperator | Account operators manage the user accounts on a computer or domain. | |
| Administrator | Administrators have complete and unrestricted access to the computer or domain. | |
| BackupOperator | Backup operators can override security restrictions for the sole purpose of backing up or restoring files. | |
| Guest | Guests are more restricted than users. | |
| PowerUser | Power users possess most administrative permissions with some restrictions. Thus, power users can run legacy applications, in addition to certified applications. | |
| PrintOperator | Print operators can take control of a printer. | |
| Replicator | Replicators support file replication in a domain. | |
| SystemOperator | System operators manage a particular computer. | |
| User | Users are prevented from making accidental or intentional system-wide changes. Thus, users can run certified applications, but not most legacy applications. |
The following example shows the use of the WindowsBuiltInRole enumeration.
public static void DemonstrateWindowsBuiltInRoleEnum() { AppDomain myDomain = Thread.GetDomain(); myDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal myPrincipal = (WindowsPrincipal)Thread.CurrentPrincipal; Console.WriteLine("{0} belongs to: ", myPrincipal.Identity.Name.ToString()); Array wbirFields = Enum.GetValues(typeof(WindowsBuiltInRole)); foreach (object roleName in wbirFields) { try { Console.WriteLine("{0}? {1}.", roleName, myPrincipal.IsInRole((WindowsBuiltInRole)roleName)); } catch (Exception) { Console.WriteLine("{0}: Could not obtain role for this RID.", roleName); } } }
public static void DemonstrateWindowsBuiltInRoleEnum()
{
AppDomain myDomain = Thread.GetDomain();
myDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal myPrincipal = ((WindowsPrincipal)
(Thread.get_CurrentPrincipal()));
Console.WriteLine("{0} belongs to: ",
myPrincipal.get_Identity().get_Name().ToString());
Array wbirFields = Enum.GetValues(WindowsBuiltInRole.class.ToType());
for (int iCtr = 0; iCtr < wbirFields.get_Count(); iCtr++) {
Object roleName = wbirFields.get_Item(iCtr);
try {
Console.WriteLine("{0}? {1}.", roleName,
System.Convert.ToString(myPrincipal.
IsInRole(((WindowsBuiltInRole)(roleName)))));
}
catch (System.Exception exp) {
Console.WriteLine(
"{0}: Could not obtain role for this RID.", roleName);
}
}
} //DemonstrateWindowsBuiltInRoleEnum
Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
Show: