다음을 통해 공유


ManagementAuthorization 클래스

정의

특정 사이트 또는 애플리케이션에 대한 권한 부여 목록을 관리하기 위한 기능을 제공합니다.

public ref class ManagementAuthorization abstract sealed
public static class ManagementAuthorization
type ManagementAuthorization = class
Public Class ManagementAuthorization
상속
ManagementAuthorization

예제

다음 예제에서는 및 클래스의 여러 메서드와 속성을 ManagementAuthorizationManagementAuthorizationInfo 구현합니다. 다음은 지정된 사이트를 지정한 사용자를 추가하고 지정된 사이트의 권한이 부여된 사용자 컬렉션을 표시하는 예제입니다.

       // Returns a Property bag that contains the Site Owner Details.
       public PropertyBag GetSiteOwnerDetails(string siteName)
       {
           PropertyBag SiteOwnerDetailsBag = new PropertyBag();

           // Set the userName.
           string userName = "User4";
                     
           string display = null;
           string message = null;
           AppDomain domain = Thread.GetDomain();
           domain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
           WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;

           // Gets the site from the siteName.
           Site site = base.ManagementUnit.ServerManager.Sites[siteName];
           // Set the path.
           string path = site.Name;
           
           SiteOwnerDetailsBag.Add(0, principal.Identity.Name);
           SiteOwnerDetailsBag.Add(1, 
               ManagementAuthorization.IsAuthorized(principal, path).ToString());
           SiteOwnerDetailsBag.Add(2, siteName as string);
           
           message = "Provider: " + ManagementAuthorization.Provider;
           display = display + message;
           // Get a collection of authorized users.
           ManagementAuthorizationInfoCollection authorizedCollection =
               ManagementAuthorization.GetAuthorizedUsers(path, true, 0, -1);
           message = "\nAuthorizedUsers count: " +
               authorizedCollection.Count.ToString() + "\n  ";
           display = display + message;
           bool isInCollection = false;
           message = null;
           // Search the returned collection.
           foreach (ManagementAuthorizationInfo authorizedInfo in authorizedCollection)
           {
               message = message + "\nName: " + authorizedInfo.Name;
               message = message + "     ConfigurationPath: " + 
                   authorizedInfo.ConfigurationPath;
               message = message + "     IsRole: " + authorizedInfo.IsRole;

               // Check to see if the user is already in the allowed users collection.                
               if (userName.Equals(authorizedInfo.Name))
               {
                   isInCollection = true;
               }
           }

           // Grant the user permission to this site only if 
           // they are not already in the allowed users collection.
           if (!isInCollection)
           {
               ManagementAuthorization.Grant(userName, path, false);
               message = message + "\nadded: " + userName;
           }
           display = display + message;

           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;

           SiteOwnerDetailsBag.Add(3, display as string);

           // Uncomment the following line to rename a configuration path. 
           // ManagementAuthorization.RenameConfigurationPath(path , path + "-new");

           // Uncomment the following line to revoke 
           // all authorizations for the specified user.
           // ManagementAuthorization.Revoke(userName);

           // Uncomment the following line to revoke the 
           // authorization for the specified user to the specified site.
           // ManagementAuthorization.Revoke(userName, path);

           // Uncomment the following line to revoke all 
           // authorization for the specified site.
           // ManagementAuthorization.RevokeConfigurationPath(path);

           return SiteOwnerDetailsBag;
       }

설명

IIS 관리자에 대한 권한은 서버 수준이 아닌 특정 사이트 또는 애플리케이션에 대해 부여됩니다. 개체는 ManagementAuthorization 사용자 또는 역할에 특정 사이트 또는 애플리케이션에 대한 액세스 권한을 부여해야 하는지 여부를 결정합니다. 권한 있는 사용자 목록은 IIS 관리자의 IIS 관리자 권한 페이지에서 사용할 수 있습니다.

이 클래스는 상속될 수 없습니다.

속성

Provider

IIS 관리자에 대한 권한 부여 공급자를 가져옵니다.

메서드

GetAuthorizedUsers(String, Boolean, Int32, Int32)

지정된 구성 경로에 대해 권한이 부여된 사용자의 컬렉션을 검색합니다.

GetConfigurationPaths(IPrincipal, String)

지정된 보안 주체가 구성할 권한이 있는 구성 경로의 배열을 반환합니다.

Grant(String, String, Boolean)

지정된 구성 경로에 대한 사용자 이름 또는 역할에 대한 권한 부여를 부여합니다.

IsAuthorized(IPrincipal, String)

지정된 보안 주체가 지정된 구성 경로에 대해 권한이 부여되었는지 여부를 나타내는 값을 검색합니다.

RenameConfigurationPath(String, String)

구성 경로의 이름을 바꿉니다.

Revoke(String)

모든 구성 경로에 대해 지정된 사용자에 대한 권한 부여를 취소합니다.

Revoke(String, String)

지정된 구성 경로에 대해 지정된 사용자에 대한 권한 부여를 취소합니다.

RevokeConfigurationPath(String)

지정된 구성 경로에서 권한 있는 모든 사용자를 제거합니다.

적용 대상

추가 정보