mscorlib(4.0.0.0) API with additions
PipeAccessRule.cs
4 
5 namespace System.IO.Pipes
6 {
8  [HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
9  public sealed class PipeAccessRule : AccessRule
10  {
13  public PipeAccessRights PipeAccessRights => RightsFromAccessMask(base.AccessMask);
14 
19  public PipeAccessRule(string identity, PipeAccessRights rights, AccessControlType type)
20  : this(new NTAccount(identity), AccessMaskFromRights(rights, type), isInherited: false, type)
21  {
22  }
23 
29  : this(identity, AccessMaskFromRights(rights, type), isInherited: false, type)
30  {
31  }
32 
33  internal PipeAccessRule(IdentityReference identity, int accessMask, bool isInherited, AccessControlType type)
34  : base(identity, accessMask, isInherited, InheritanceFlags.None, PropagationFlags.None, type)
35  {
36  }
37 
38  internal static int AccessMaskFromRights(PipeAccessRights rights, AccessControlType controlType)
39  {
40  if (rights < (PipeAccessRights)0 || rights > (PipeAccessRights.ReadData | PipeAccessRights.WriteData | PipeAccessRights.ReadAttributes | PipeAccessRights.WriteAttributes | PipeAccessRights.ReadExtendedAttributes | PipeAccessRights.WriteExtendedAttributes | PipeAccessRights.CreateNewInstance | PipeAccessRights.Delete | PipeAccessRights.ReadPermissions | PipeAccessRights.ChangePermissions | PipeAccessRights.TakeOwnership | PipeAccessRights.Synchronize | PipeAccessRights.AccessSystemSecurity))
41  {
42  throw new ArgumentOutOfRangeException("rights", System.SR.GetString("ArgumentOutOfRange_NeedValidPipeAccessRights"));
43  }
44  switch (controlType)
45  {
46  case AccessControlType.Allow:
47  rights |= PipeAccessRights.Synchronize;
48  break;
49  case AccessControlType.Deny:
50  if (rights != PipeAccessRights.FullControl)
51  {
52  rights &= ~PipeAccessRights.Synchronize;
53  }
54  break;
55  }
56  return (int)rights;
57  }
58 
59  internal static PipeAccessRights RightsFromAccessMask(int accessMask)
60  {
61  return (PipeAccessRights)accessMask;
62  }
63  }
64 }
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...
PipeAccessRights PipeAccessRights
Gets the T:System.IO.Pipes.PipeAccessRights flags that are associated with the current T:System....
Represents a user or group account.
Definition: NTAccount.cs:10
SecurityAction
Specifies the security actions that can be performed using declarative security.
PipeAccessRule(IdentityReference identity, PipeAccessRights rights, AccessControlType type)
Initializes a new instance of the T:System.IO.Pipes.PipeAccessRule class with the specified identity,...
Definition: SR.cs:7
AccessControlType
Specifies whether an T:System.Security.AccessControl.AccessRule object is used to allow or deny acces...
PipeAccessRule(string identity, PipeAccessRights rights, AccessControlType type)
Initializes a new instance of the T:System.IO.Pipes.PipeAccessRule class with the specified identity,...
PipeAccessRights
Defines the access rights to use when you create access and audit rules.
Represents an abstraction of an access control entry (ACE) that defines an access rule for a pipe.
InheritanceFlags
Inheritance flags specify the semantics of inheritance for access control entries (ACEs).
Indicates that there are no additional parameters.