mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Object System.Security.Principal.IPrincipal This class represents the group membership of an operating system user.

The WindowsPrincipal class can also be used on POSIX compliant operating system.

`using System; using System.Runtime.InteropServices; using System.Security.Principal; class WinPrincipal { [DllImport ("advapi32.dll", CallingConvention=CallingConvention.StdCall)] public static extern bool LogonUser (string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); static void Principal (WindowsIdentity user) { WindowsPrincipal wp = new WindowsPrincipal (user); while (true) { Console.Write ("Enter group name: "); string group = Console.ReadLine (); if (group == String.Empty) break; Console.WriteLine ("\t{0} is {1}a member of {2}{3}", user.Name, (wp.IsInRole (group) ? String.Empty : "NOT "), group, Environment.NewLine); } } [STAThread] static void Main (string[] args) { bool posix = ((int) Environment.OSVersion.Platform == 128); while (true) { Console.Write ("Enter username:\t"); string username = Console.ReadLine (); if (username == String.Empty) break; WindowsIdentity user = null; // check for Posix versus Windows if (posix) { user = new WindowsIdentity (username); } else { Console.Write ("Enter domain:\t"); string domain = Console.ReadLine (); Console.Write ("Enter password:\t"); string password = Console.ReadLine (); IntPtr token = IntPtr.Zero; // note: we should close that handle LogonUser (username, domain, password, 2, 0, ref token); if (token == IntPtr.Zero) { Console.WriteLine ("Invalid username/domain/password"); continue; } user = new WindowsIdentity (token); } Principal (user); } } }`
- Constructor
  The identity for which the principal will be created.
  Creates the corresponding principal of a WindowsIdentity instance.
  To be added
  1.0.5000.0
  2.0.0.0
- Property
  System.Security.Principal.IIdentity The operating system identity associated with the current principal. The current identity of the principal. The returned identity will always be a instance. 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` An integer representing the group. Return the membership of the current principal in the specified role. True if the current identity is a member of the specified role, false otherwise. The role id, is mapped like this:
  Role ID
  Description
  544
  BUILTIN\\Administrators
  545
  BUILTIN\\Users
  546
  BUILTIN\\Guests
  547
  BUILTIN\\Power Users
  548
  BUILTIN\\Account Operators
  549
  BUILTIN\\System Operators
  550
  BUILTIN\\Print Operators
  551
  BUILTIN\\Backup Operators
  552
  BUILTIN\\Replicator 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` To be added. To be added. To be added. To be added. 2.0.0.0 System.Runtime.InteropServices.ComVisible(false)
- Method
  System.Boolean `` A member of the enumeration. Return the membership of the current principal in the specified role. True if the current identity is a member of the specified role, false otherwise. On POSIX compliant systems the group is mapped to the "root" group. All other groups will return false. 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` The group name. Return the membership of the current principal in the specified role. True if the current identity is a member of the specified role, false otherwise. On Unix systems, the role is mapped to Unix groups. For users to be considered to have a certain role, the role must be listed in the Unix groups (the /etc/group file) and it must contain a list of users that belong to that group.

  For example, if you want to check that the user is in role "USAGNT\\UGR_RBP" the file /etc/group should contain a line like this:

  `USAGNT\UGR_RBP:x:300:miguel,don,jon,julia`

  In this particular example, the users miguel, don, jon and julia belong to the "USAGNT\UGR_RBP" role.

  1.0.5000.0
  2.0.0.0
System.Runtime.InteropServices.ComVisible(true)