ServicesCtl.Administrator Class Reference

This class handles the impersonation of the current user to an Administator account. More...

List of all members.

Public Member Functions

 Administrator ()
 Creates a new instance.
bool Impersonate ()
 Impersonates the current user to an Administrator.
void Deimpersonate ()
 Resets the current Thread to the current user.

Static Public Member Functions

static string GetErrorMessage (int errorCode)
 Helper method to request an error message for a given error number from the OS.

Private Member Functions

bool login ()
 Creates a LoginToken for an administrator.
bool IsAdministrator (IntPtr loginToken)
 Check whether the user is part of the administrator group.

Private Attributes

ResourceManager messages = null
 A private ResourceManager for handling internationalization.
IntPtr loginToken = new IntPtr(0)
 The LoginToken of a Administrator or null.
WindowsImpersonationContext impersonatedUser = null
 The WindowsImpersonationContext after impersonation to an Administrator, used to "De"-Impersonate.

Static Private Attributes

static readonly ILog log = LogManager.GetLogger(typeof(Administrator))
 The private Logger.


Detailed Description

This class handles the impersonation of the current user to an Administator account.


Constructor & Destructor Documentation

ServicesCtl.Administrator.Administrator (  ) 

Creates a new instance.

Initializes the ResourceManager Administrator.messages.


Member Function Documentation

bool ServicesCtl.Administrator.login (  )  [private]

Creates a LoginToken for an administrator.

Returns:
true when a LoginToken with Administrator rights has been created.
Opens a LoginForm to ask for Login data and tries to login with these data.

bool ServicesCtl.Administrator.Impersonate (  ) 

Impersonates the current user to an Administrator.

Returns:
true when the Thread is now in the context of an Administrator
Creates an Administrator LoginToken when needed.

void ServicesCtl.Administrator.Deimpersonate (  ) 

Resets the current Thread to the current user.

bool ServicesCtl.Administrator.IsAdministrator ( IntPtr  loginToken  )  [private]

Check whether the user is part of the administrator group.

Parameters:
loginToken the LoginToken to check
Returns:
true when the LoginToken represents an Administrator account.

static string ServicesCtl.Administrator.GetErrorMessage ( int  errorCode  )  [static]

Helper method to request an error message for a given error number from the OS.

Parameters:
errorCode The Error code
Returns:
The Error message or null


Member Data Documentation

ResourceManager ServicesCtl.Administrator.messages = null [private]

A private ResourceManager for handling internationalization.

IntPtr ServicesCtl.Administrator.loginToken = new IntPtr(0) [private]

The LoginToken of a Administrator or null.

WindowsImpersonationContext ServicesCtl.Administrator.impersonatedUser = null [private]

The WindowsImpersonationContext after impersonation to an Administrator, used to "De"-Impersonate.

readonly ILog ServicesCtl.Administrator.log = LogManager.GetLogger(typeof(Administrator)) [static, private]

The private Logger.


The documentation for this class was generated from the following file:
Generated on Tue May 1 16:31:06 2007 for ServiceCtl by  doxygen 1.5.2