Share via


EventWaitHandleAccessRule 생성자

정의

EventWaitHandleAccessRule 클래스의 새 인스턴스를 초기화합니다.

오버로드

EventWaitHandleAccessRule(IdentityReference, EventWaitHandleRights, AccessControlType)

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

EventWaitHandleAccessRule(String, EventWaitHandleRights, AccessControlType)

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

EventWaitHandleAccessRule(IdentityReference, EventWaitHandleRights, AccessControlType)

Source:
EventWaitHandleSecurity.cs
Source:
EventWaitHandleSecurity.cs
Source:
EventWaitHandleSecurity.cs
Source:
EventWaitHandleSecurity.cs

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

public:
 EventWaitHandleAccessRule(System::Security::Principal::IdentityReference ^ identity, System::Security::AccessControl::EventWaitHandleRights eventRights, System::Security::AccessControl::AccessControlType type);
public EventWaitHandleAccessRule (System.Security.Principal.IdentityReference identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AccessControlType type);
new System.Security.AccessControl.EventWaitHandleAccessRule : System.Security.Principal.IdentityReference * System.Security.AccessControl.EventWaitHandleRights * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.EventWaitHandleAccessRule
Public Sub New (identity As IdentityReference, eventRights As EventWaitHandleRights, type As AccessControlType)

매개 변수

identity
IdentityReference

규칙을 적용할 사용자나 그룹입니다. 이 값은 SecurityIdentifier 형식이거나 NTAccount와 같이 SecurityIdentifier 형식으로 변환할 수 있는 형식이어야 합니다.

eventRights
EventWaitHandleRights

허용 또는 거부 권한을 지정하는 EventWaitHandleRights 값의 비트 조합입니다.

type
AccessControlType

권한 허용 여부를 지정하는 AccessControlType 값 중 하나입니다.

예외

eventRights가 잘못된 값을 지정하는 경우

또는

type가 잘못된 값을 지정하는 경우

identity이(가) null인 경우

또는

eventRights가 0입니다.

identity의 형식이 SecurityIdentifier도 아니고 NTAccount와 같이 SecurityIdentifier 형식으로 변환할 수 있는 형식도 아닌 경우

설명

를 대기 EventWaitHandle 하려면(또는 WaitAll 메서드를 WaitOneWaitAny 호출하여) 사용자에게 액세스 권한이 EventWaitHandleRights.Synchronize 있어야 합니다. 메서드를 호출하여 이벤트를 신호로 보내거나 메서드를 호출 Set 하여 서명되지 않은 상태로 다시 설정 Reset 하려면 사용자에게 액세스 권한이 EventWaitHandleRights.Modify 있어야 합니다. 개체에 EventWaitHandle 신호를 표시한 다음 메서드를 호출 SignalAndWait 하여 대기하려면 사용자에게 및 Modify 액세스 권한이 Synchronize 있어야 합니다.

적용 대상

EventWaitHandleAccessRule(String, EventWaitHandleRights, AccessControlType)

Source:
EventWaitHandleSecurity.cs
Source:
EventWaitHandleSecurity.cs
Source:
EventWaitHandleSecurity.cs
Source:
EventWaitHandleSecurity.cs

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

public:
 EventWaitHandleAccessRule(System::String ^ identity, System::Security::AccessControl::EventWaitHandleRights eventRights, System::Security::AccessControl::AccessControlType type);
public EventWaitHandleAccessRule (string identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AccessControlType type);
new System.Security.AccessControl.EventWaitHandleAccessRule : string * System.Security.AccessControl.EventWaitHandleRights * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.EventWaitHandleAccessRule
Public Sub New (identity As String, eventRights As EventWaitHandleRights, type As AccessControlType)

매개 변수

identity
String

규칙을 적용할 사용자나 그룹의 이름입니다.

eventRights
EventWaitHandleRights

허용 또는 거부 권한을 지정하는 EventWaitHandleRights 값의 비트 조합입니다.

type
AccessControlType

권한 허용 여부를 지정하는 AccessControlType 값 중 하나입니다.

예외

eventRights가 잘못된 값을 지정하는 경우

또는

type가 잘못된 값을 지정하는 경우

eventRights가 0입니다.

identity이(가) null인 경우

또는

identity이 빈 문자열입니다.

또는

identity이 512자보다 깁니다.

예제

다음 코드 예제에서는이 생성자를 사용 하 여 개체를 만드는 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

설명

를 대기 EventWaitHandle 하려면(또는 WaitAll 메서드를 WaitOneWaitAny 호출하여) 사용자에게 액세스 권한이 EventWaitHandleRights.Synchronize 있어야 합니다. 메서드를 호출하여 이벤트를 신호로 보내거나 메서드를 호출 Set 하여 서명되지 않은 상태로 다시 설정 Reset 하려면 사용자에게 액세스 권한이 EventWaitHandleRights.Modify 있어야 합니다. 개체에 EventWaitHandle 신호를 표시한 다음 메서드를 호출 SignalAndWait 하여 대기하려면 사용자에게 및 Modify 액세스 권한이 Synchronize 있어야 합니다.

이 생성자는 생성자에 전달 identity 하고 새로 만든 개체를 NTAccount.NTAccount(String) 생성자에 전달하여 개체를 만드는 NTAccountNTAccount 것과 EventWaitHandleAccessRule(IdentityReference, EventWaitHandleRights, AccessControlType) 같습니다.

적용 대상