ManagementAuthorization.Grant(String, String, Boolean) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 구성 경로에 대한 사용자 이름 또는 역할에 대한 권한 부여를 부여합니다.
public:
static Microsoft::Web::Management::Server::ManagementAuthorizationInfo ^ Grant(System::String ^ name, System::String ^ configurationPath, bool isRole);
public static Microsoft.Web.Management.Server.ManagementAuthorizationInfo Grant (string name, string configurationPath, bool isRole);
static member Grant : string * string * bool -> Microsoft.Web.Management.Server.ManagementAuthorizationInfo
Public Shared Function Grant (name As String, configurationPath As String, isRole As Boolean) As ManagementAuthorizationInfo
매개 변수
- name
- String
권한을 부여할 사용자 이름입니다.
- configurationPath
- String
권한 부여를 부여할 구성 경로입니다.
- isRole
- Boolean
true
매개 변수에 name
지정된 값이 보안 역할임을 나타내려면 이고, false
그렇지 않으면 입니다.
반환
ManagementAuthorizationInfo 개체입니다.
예외
name
가 null
이거나 비어 있는 경우
예제
다음 예제는 Grant 메서드. 이 예제에서는 지정된 사용자가 이미 권한 있는 사용자 컬렉션에 있는지 확인합니다. 사용자가 컬렉션에 아직 없는 경우 메서드는 Grant 사용자에게 권한 부여를 부여합니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ManagementAuthorization 클래스입니다.
// 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;
설명
이 메서드는 지정된 경로에 대해 권한이 부여된 사용자 컬렉션에 사용자를 삽입합니다. 사용자에게 사이트에 대한 권한이 부여되면 사용자는 메서드에서 반환된 GetAuthorizedUsers 컬렉션과 IIS 관리자의 IIS 관리자 권한 페이지에 있는 사용자 목록에 포함됩니다.
이 메서드는 , configurationPath
및 isRole
매개 변수 값이 있는 새 ManagementAuthorizationInfo 개체를 name
생성합니다. 사용자에게 권한 부여를 부여하면 Administration.config 파일이 수정됩니다.
권한이 부여된 사용자 컬렉션에 이미 있는 사용자에게 권한 부여를 시도하면 예외가 throw됩니다.