Retrieves a value indicating whether the specified principal is authorized for the specified configuration path.
Namespace:
Microsoft.Web.Management.Server
Assembly:
Microsoft.Web.Management (in Microsoft.Web.Management.dll)
Visual Basic (Declaration)
Public Shared Function IsAuthorized ( _
principal As IPrincipal, _
configurationPath As String _
) As Boolean
Dim principal As IPrincipal
Dim configurationPath As String
Dim returnValue As Boolean
returnValue = ManagementAuthorization.IsAuthorized(principal, _
configurationPath)
public static bool IsAuthorized(
IPrincipal principal,
string configurationPath
)
public:
static bool IsAuthorized(
IPrincipal^ principal,
String^ configurationPath
)
public static function IsAuthorized(
principal : IPrincipal,
configurationPath : String
) : boolean
Return Value
Type:
System..::.Boolean
true if the principal is authorized for the specified configuration path; otherwise, false.
This method checks the Administration.config file to determine whether the principal is an authorized user for the specified configuration path.
The following example demonstrates the IsAuthorized method. This code example is part of a larger example provided for the ManagementAuthorization class.
SiteOwnerDetailsBag.Add(0, principal.Identity.Name)
SiteOwnerDetailsBag.Add(1, ManagementAuthorization.IsAuthorized(principal, path).ToString)
SiteOwnerDetailsBag.Add(2, siteName)
SiteOwnerDetailsBag.Add(1,
ManagementAuthorization.IsAuthorized(principal, path).ToString());
SiteOwnerDetailsBag.Add(2, siteName as string);
The following example sets the principal parameter to an object that enables you to check the Windows group membership of the current user.
Thread.GetDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
Dim principal As WindowsPrincipal = DirectCast(Thread.CurrentPrincipal, WindowsPrincipal)
AppDomain domain = Thread.GetDomain();
domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Reference