asp.net.ph

WindowsBuiltInRole Enumeration

System.Security.Principal Namespace


Specifies common roles to be used with IsInRole.

Members


Member 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.

Remarks

These roles represent the local Windows groups common to most installations of Windows NT, Windows 2000 and Windows XP.

Example

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 );
      }
   }
}
  C# VB

See Also

WindowsIdentity Class   WindowsPrincipal Class Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph