mscorlib(4.0.0.0) API with additions
AccessRule.cs
2 
4 {
7  public class AccessRule<T> : AccessRule where T : struct
8  {
11  public T Rights => (T)(object)base.AccessMask;
12 
17  public AccessRule(IdentityReference identity, T rights, AccessControlType type)
18  : this(identity, (int)(object)rights, isInherited: false, InheritanceFlags.None, PropagationFlags.None, type)
19  {
20  }
21 
26  public AccessRule(string identity, T rights, AccessControlType type)
27  : this((IdentityReference)new NTAccount(identity), (int)(object)rights, isInherited: false, InheritanceFlags.None, PropagationFlags.None, type)
28  {
29  }
30 
37  public AccessRule(IdentityReference identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
38  : this(identity, (int)(object)rights, isInherited: false, inheritanceFlags, propagationFlags, type)
39  {
40  }
41 
48  public AccessRule(string identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
49  : this((IdentityReference)new NTAccount(identity), (int)(object)rights, isInherited: false, inheritanceFlags, propagationFlags, type)
50  {
51  }
52 
53  internal AccessRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
54  : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, type)
55  {
56  }
57  }
59  public abstract class AccessRule : AuthorizationRule
60  {
61  private readonly AccessControlType _type;
62 
66 
77  protected AccessRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
78  : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags)
79  {
80  if (type != 0 && type != AccessControlType.Deny)
81  {
82  throw new ArgumentOutOfRangeException("type", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
83  }
84  if (inheritanceFlags < InheritanceFlags.None || inheritanceFlags > (InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit))
85  {
86  throw new ArgumentOutOfRangeException("inheritanceFlags", Environment.GetResourceString("Argument_InvalidEnumValue", inheritanceFlags, "InheritanceFlags"));
87  }
88  if (propagationFlags < PropagationFlags.None || propagationFlags > (PropagationFlags.NoPropagateInherit | PropagationFlags.InheritOnly))
89  {
90  throw new ArgumentOutOfRangeException("propagationFlags", Environment.GetResourceString("Argument_InvalidEnumValue", inheritanceFlags, "PropagationFlags"));
91  }
92  _type = type;
93  }
94  }
95 }
PropagationFlags
Specifies how Access Control Entries (ACEs) are propagated to child objects. These flags are signific...
Represents an identity and is the base class for the T:System.Security.Principal.NTAccount and T:Syst...
Represents a combination of a user's identity, an access mask, and an access control type (allow or d...
Definition: AccessRule.cs:7
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
AccessRule(string identity, T rights, AccessControlType type)
Initializes a new instance of the AccessRule’1 class by using the specified values.
Definition: AccessRule.cs:26
AccessRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
Initializes a new instance of the T:System.Security.AccessControl.AccessRule class by using the speci...
Definition: AccessRule.cs:77
Represents a user or group account.
Definition: NTAccount.cs:10
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
AccessRule(IdentityReference identity, T rights, AccessControlType type)
Initializes a new instance of the AccessRule’1 class by using the specified values.
Definition: AccessRule.cs:17
T Rights
Gets the rights of the current instance.
Definition: AccessRule.cs:11
AccessControlType
Specifies whether an T:System.Security.AccessControl.AccessRule object is used to allow or deny acces...
AccessRule(IdentityReference identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
Initializes a new instance of the AccessRule’1 class by using the specified values.
Definition: AccessRule.cs:37
AccessRule(string identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
Initializes a new instance of the AccessRule’1 class by using the specified values.
Definition: AccessRule.cs:48
AccessControlType AccessControlType
Gets the T:System.Security.AccessControl.AccessControlType value associated with this T:System....
Definition: AccessRule.cs:65
InheritanceFlags
Inheritance flags specify the semantics of inheritance for access control entries (ACEs).