Share via


ManagementAuthorization.GetConfigurationPaths(IPrincipal, String) Method

Definition

Returns an array of configuration paths that the specified principal is authorized to configure.

public:
 static cli::array <System::String ^> ^ GetConfigurationPaths(System::Security::Principal::IPrincipal ^ principal, System::String ^ baseConfigurationPath);
public static string[] GetConfigurationPaths (System.Security.Principal.IPrincipal principal, string baseConfigurationPath);
static member GetConfigurationPaths : System.Security.Principal.IPrincipal * string -> string[]
Public Shared Function GetConfigurationPaths (principal As IPrincipal, baseConfigurationPath As String) As String()

Parameters

principal
IPrincipal

A IPrincipal interface that represents the security context of the user for whom the paths are retrieved.

baseConfigurationPath
String

The base of the configuration path under which to search.

Returns

String[]

An array of configuration paths that the specified principal is authorized to configure.

Exceptions

principal is null.

Examples

The following example demonstrates the GetConfigurationPaths method. This code example is part of a larger example provided for the ManagementAuthorization class.

           string[] configPaths = 
               ManagementAuthorization.GetConfigurationPaths(principal, null);

           message = "\n\nThe current user is a member of " + 
               configPaths.Length + " paths.";
           foreach (string configpath in configPaths)
           {
               message = message + "\npath: " + configpath;
           }
           display = display + message;

The following example sets the principal parameter to an object that enables you to check the Windows group membership of the current user.

AppDomain domain = Thread.GetDomain();
domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;

Remarks

This method returns all configuration paths, starting with the baseConfigurationPath parameter, for which the principal is an authorized user and has access permissions. Set baseConfigurationPath to empty or null to search the entire site. baseConfigurationPath determines which nodes in the Administration.config file can be searched for authorized users.

Applies to