EventWaitHandleAccessRule 클래스

정의

사용자 또는 그룹에 대해 허용 또는 거부된 액세스 권한 집합을 나타냅니다. 이 클래스는 상속될 수 없습니다.

public ref class EventWaitHandleAccessRule sealed : System::Security::AccessControl::AccessRule
public sealed class EventWaitHandleAccessRule : System.Security.AccessControl.AccessRule
[System.Security.SecurityCritical]
public sealed class EventWaitHandleAccessRule : System.Security.AccessControl.AccessRule
type EventWaitHandleAccessRule = class
    inherit AccessRule
[<System.Security.SecurityCritical>]
type EventWaitHandleAccessRule = class
    inherit AccessRule
Public NotInheritable Class EventWaitHandleAccessRule
Inherits AccessRule
상속
EventWaitHandleAccessRule
특성

예제

다음 코드 예제에서는 개체를 만들고 사용하는 방법을 EventWaitHandleAccessRule 보여 줍니다. 이 예제에서는 개체를 EventWaitHandleSecurity 만들고, 현재 사용자에 대한 다양한 권한을 허용 및 거부하는 규칙을 추가하고, 결과 규칙 쌍을 표시합니다. 그런 다음, 이 예제에서는 현재 사용자에 대한 새 권한을 허용하고 결과를 표시하여 새 권한이 기존 규칙과 병합됨을 Allow 보여 줍니다.

참고

이 예제에서는 보안 개체를 개체에 EventWaitHandle 연결하지 않습니다. 보안 개체를 연결하는 예제는 및 EventWaitHandle.SetAccessControl에서 EventWaitHandle.GetAccessControl 찾을 수 있습니다.

using System;
using System.Threading;
using System.Security.AccessControl;
using System.Security.Principal;

public class Example
{
    public static void Main()
    {
        // Create a string representing the current user.
        string user = Environment.UserDomainName + "\\" + 
            Environment.UserName;

        // Create a security object that grants no access.
        EventWaitHandleSecurity mSec = new EventWaitHandleSecurity();

        // Add a rule that grants the current user the 
        // right to wait on or signal the event.
        EventWaitHandleAccessRule rule = new EventWaitHandleAccessRule(user, 
            EventWaitHandleRights.Synchronize | EventWaitHandleRights.Modify, 
            AccessControlType.Allow);
        mSec.AddAccessRule(rule);

        // Add a rule that denies the current user the 
        // right to change permissions on the event.
        rule = new EventWaitHandleAccessRule(user, 
            EventWaitHandleRights.ChangePermissions, 
            AccessControlType.Deny);
        mSec.AddAccessRule(rule);

        // Display the rules in the security object.
        ShowSecurity(mSec);

        // Add a rule that allows the current user the 
        // right to read permissions on the event. This rule
        // is merged with the existing Allow rule.
        rule = new EventWaitHandleAccessRule(user, 
            EventWaitHandleRights.ReadPermissions, 
            AccessControlType.Allow);
        mSec.AddAccessRule(rule);

        ShowSecurity(mSec);
    }

    private static void ShowSecurity(EventWaitHandleSecurity security)
    {
        Console.WriteLine("\r\nCurrent access rules:\r\n");

        foreach(EventWaitHandleAccessRule ar in 
            security.GetAccessRules(true, true, typeof(NTAccount)))
        {
            Console.WriteLine("        User: {0}", ar.IdentityReference);
            Console.WriteLine("        Type: {0}", ar.AccessControlType);
            Console.WriteLine("      Rights: {0}", ar.EventWaitHandleRights);
            Console.WriteLine();
        }
    }
}

/*This code example produces output similar to following:

Current access rules:

        User: TestDomain\TestUser
        Type: Deny
      Rights: ChangePermissions

        User: TestDomain\TestUser
        Type: Allow
      Rights: Modify, Synchronize


Current access rules:

        User: TestDomain\TestUser
        Type: Deny
      Rights: ChangePermissions

        User: TestDomain\TestUser
        Type: Allow
      Rights: Modify, ReadPermissions, Synchronize
 */
Imports System.Threading
Imports System.Security.AccessControl
Imports System.Security.Principal

Public Class Example

    Public Shared Sub Main()

        ' Create a string representing the current user.
        Dim user As String = Environment.UserDomainName _ 
            & "\" & Environment.UserName

        ' Create a security object that grants no access.
        Dim mSec As New EventWaitHandleSecurity()

        ' Add a rule that grants the current user the 
        ' right to wait on or signal the event.
        Dim rule As New EventWaitHandleAccessRule(user, _
            EventWaitHandleRights.Synchronize _
            Or EventWaitHandleRights.Modify, _
            AccessControlType.Allow)
        mSec.AddAccessRule(rule)

        ' Add a rule that denies the current user the 
        ' right to change permissions on the event.
        rule = New EventWaitHandleAccessRule(user, _
            EventWaitHandleRights.ChangePermissions, _
            AccessControlType.Deny)
        mSec.AddAccessRule(rule)

        ' Display the rules in the security object.
        ShowSecurity(mSec)

        ' Add a rule that allows the current user the 
        ' right to read permissions on the event. This rule
        ' is merged with the existing Allow rule.
        rule = New EventWaitHandleAccessRule(user, _
            EventWaitHandleRights.ReadPermissions, _
            AccessControlType.Allow)
        mSec.AddAccessRule(rule)

        ShowSecurity(mSec)

    End Sub 

    Private Shared Sub ShowSecurity(ByVal security As EventWaitHandleSecurity)
        Console.WriteLine(vbCrLf & "Current access rules:" & vbCrLf)

        For Each ar As EventWaitHandleAccessRule In _
            security.GetAccessRules(True, True, GetType(NTAccount))

            Console.WriteLine("        User: {0}", ar.IdentityReference)
            Console.WriteLine("        Type: {0}", ar.AccessControlType)
            Console.WriteLine("      Rights: {0}", ar.EventWaitHandleRights)
            Console.WriteLine()
        Next

    End Sub
End Class 

'This code example produces output similar to following:
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Deny
'      Rights: ChangePermissions
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: Modify, Synchronize
'
'
'Current access rules:
'
'        User: TestDomain\TestUser
'        Type: Deny
'      Rights: ChangePermissions
'
'        User: TestDomain\TestUser
'        Type: Allow
'      Rights: Modify, ReadPermissions, Synchronize

설명

클래스는 EventWaitHandleAccessRule .NET Framework 명명된 시스템 이벤트에서 Windows 액세스 제어 보안을 관리하기 위해 제공하는 클래스 집합 중 하나입니다. 이러한 클래스 및 기본 Windows 액세스 제어 구조와의 관계에 대한 개요는 을 참조하세요 EventWaitHandleSecurity.

참고

Windows 액세스 제어 보안은 명명된 시스템 이벤트에만 의미가 있습니다. 개체가 EventWaitHandle 로컬 이벤트를 나타내는 경우 액세스 제어는 관련이 없습니다.

명명된 이벤트에 현재 적용된 규칙 목록을 가져오려면 메서드를 사용하여 EventWaitHandle.GetAccessControl 개체를 EventWaitHandleSecurity 가져온 다음 해당 메서드를 GetAccessRules 사용하여 개체 컬렉션을 EventWaitHandleAccessRule 가져옵니다.

EventWaitHandleAccessRule 개체는 기본 DACL(임의 액세스 제어 목록)의 액세스 제어 항목과 일대일로 매핑되지 않습니다. 이벤트에 대한 모든 액세스 규칙 집합을 가져오는 경우 집합에는 현재 모든 액세스 제어 항목을 표현하는 데 필요한 최소 규칙 수가 포함됩니다.

참고

규칙을 적용하고 제거하면 기본 액세스 제어 항목이 변경됩니다. 가능한 경우 규칙의 정보가 병합되어 가장 적은 수의 액세스 제어 항목을 유지 관리합니다. 따라서 현재 규칙 목록을 가져올 때 추가한 모든 규칙 목록과 정확히 일치하지 않을 수 있습니다.

개체를 사용하여 EventWaitHandleAccessRule 사용자 또는 그룹을 허용하거나 거부할 액세스 권한을 지정합니다. 개체는 EventWaitHandleAccessRule 항상 허용된 액세스 또는 액세스 거부를 나타내며 둘 다 나타내지 않습니다.

명명된 시스템 이벤트에 규칙을 적용하려면 메서드를 EventWaitHandle.GetAccessControl 사용하여 개체를 EventWaitHandleSecurity 가져옵니다. 메서드를 사용하여 개체를 EventWaitHandleSecurity 수정하여 규칙을 추가한 다음, 메서드를 EventWaitHandle.SetAccessControl 사용하여 보안 개체를 다시 연결합니다.

중요

변경된 보안 개체를 EventWaitHandleSecurity 명명된 이벤트에 할당하기 위해 메서드를 호출 EventWaitHandle.SetAccessControl 할 때까지 개체를 변경해도 명명된 이벤트의 액세스 수준에 영향을 미치지 않습니다.

EventWaitHandleAccessRule 개체는 변경할 수 없습니다. 이벤트에 대한 보안은 클래스의 EventWaitHandleSecurity 메서드를 사용하여 규칙을 추가하거나 제거하여 수정됩니다. 이렇게 하면 기본 액세스 제어 항목이 수정됩니다.

생성자

EventWaitHandleAccessRule(IdentityReference, EventWaitHandleRights, AccessControlType)

EventWaitHandleAccessRule 클래스의 새 인스턴스를 초기화하여 규칙을 적용할 사용자 또는 그룹, 액세스 권한 및 지정된 액세스 권한의 허용 또는 거부를 지정합니다.

EventWaitHandleAccessRule(String, EventWaitHandleRights, AccessControlType)

EventWaitHandleAccessRule 클래스의 새 인스턴스를 초기화하여 규칙을 적용할 사용자 또는 그룹의 이름, 액세스 권한 및 지정된 액세스 권한의 허용 또는 거부 여부를 지정합니다.

속성

AccessControlType

AccessControlType 개체와 관련된 AccessRule 값을 가져옵니다.

(다음에서 상속됨 AccessRule)
AccessMask

이 규칙의 액세스 마스크를 가져옵니다.

(다음에서 상속됨 AuthorizationRule)
EventWaitHandleRights

액세스 규칙에 의해 허용 또는 거부된 권한을 가져옵니다.

IdentityReference

이 규칙이 적용되는 IdentityReference를 가져옵니다.

(다음에서 상속됨 AuthorizationRule)
InheritanceFlags

이 규칙이 자식 개체에서 상속되는 방식을 결정하는 플래그 값을 가져옵니다.

(다음에서 상속됨 AuthorizationRule)
IsInherited

이 규칙이 명시적으로 설정되는지 아니면 부모 컨테이너 개체에서 상속되는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 AuthorizationRule)
PropagationFlags

이 규칙의 상속이 자식 개체에 전파되는 방법을 결정하는 전파 플래그의 값을 가져옵니다. 이 속성은 InheritanceFlags 열거형의 값이 None이 아닐 때만 중요합니다.

(다음에서 상속됨 AuthorizationRule)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보