7 [PermissionSet(
SecurityAction.InheritanceDemand, Name =
"FullTrust")]
14 : base(isContainer, isDS: false)
19 : base(securityDescriptor)
23 private AuthorizationRuleCollection GetRules(
bool access,
bool includeExplicit,
bool includeInherited,
Type targetType)
28 AuthorizationRuleCollection authorizationRuleCollection =
new AuthorizationRuleCollection();
33 CommonAcl commonAcl =
null;
36 if ((_securityDescriptor.ControlFlags &
ControlFlags.DiscretionaryAclPresent) != 0)
38 commonAcl = _securityDescriptor.DiscretionaryAcl;
41 else if ((_securityDescriptor.ControlFlags &
ControlFlags.SystemAclPresent) != 0)
43 commonAcl = _securityDescriptor.SystemAcl;
45 if (commonAcl ==
null)
47 return authorizationRuleCollection;
53 for (
int i = 0; i < commonAcl.Count; i++)
55 CommonAce commonAce = commonAcl[i] as CommonAce;
56 if (AceNeedsTranslation(commonAce, access, includeExplicit, includeInherited))
58 identityReferenceCollection2.
Add(commonAce.SecurityIdentifier);
61 identityReferenceCollection = identityReferenceCollection2.
Translate(targetType);
64 for (
int j = 0; j < commonAcl.Count; j++)
66 CommonAce commonAce2 = commonAcl[j] as CommonAce;
67 if (AceNeedsTranslation(commonAce2, access, includeExplicit, includeInherited))
72 authorizationRuleCollection.AddRule(AccessRuleFactory(type: (commonAce2.AceQualifier != 0) ?
AccessControlType.Deny :
AccessControlType.Allow, identityReference: identityReference, accessMask: commonAce2.AccessMask, isInherited: commonAce2.IsInherited, inheritanceFlags: commonAce2.InheritanceFlags, propagationFlags: commonAce2.PropagationFlags));
76 authorizationRuleCollection.AddRule(AuditRuleFactory(identityReference, commonAce2.AccessMask, commonAce2.IsInherited, commonAce2.InheritanceFlags, commonAce2.PropagationFlags, commonAce2.AuditFlags));
80 return authorizationRuleCollection;
88 private bool AceNeedsTranslation(CommonAce ace,
bool isAccessAce,
bool includeExplicit,
bool includeInherited)
96 if (ace.AceQualifier != 0 && ace.AceQualifier !=
AceQualifier.AccessDenied)
105 if ((includeExplicit && (ace.AceFlags &
AceFlags.Inherited) ==
AceFlags.None) || (includeInherited && (ace.AceFlags &
AceFlags.Inherited) != 0))
129 if (_securityDescriptor.DiscretionaryAcl ==
null)
137 _securityDescriptor.AddControlFlags(
ControlFlags.DiscretionaryAclPresent);
142 switch (modification)
177 switch (modification)
207 base.AccessRulesModified |= modified;
233 if (_securityDescriptor.SystemAcl ==
null)
241 _securityDescriptor.AddControlFlags(
ControlFlags.SystemAclPresent);
244 switch (modification)
272 base.AuditRulesModified |= modified;
351 if (_securityDescriptor ==
null)
375 if (_securityDescriptor !=
null)
397 if (_securityDescriptor !=
null)
515 return GetRules(access:
true, includeExplicit, includeInherited, targetType);
527 return GetRules(access:
false, includeExplicit, includeInherited, targetType);
void SetAuditRule(AuditRule rule)
Removes all audit rules that contain the same security identifier and qualifier as the specified audi...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
PropagationFlags
Specifies how Access Control Entries (ACEs) are propagated to child objects. These flags are signific...
Provides the ability to control access to objects without direct manipulation of Access Control Lists...
internal int AccessMask
Gets the access mask for this rule.
override bool ModifyAccess(AccessControlModification modification, AccessRule rule, out bool modified)
Applies the specified modification to the Discretionary Access Control List (DACL) associated with th...
void AddAuditRule(AuditRule rule)
Adds the specified audit rule to the System Access Control List (SACL) associated with this T:System....
void SetAccessRule(AccessRule rule)
Removes all access rules that contain the same security identifier and qualifier as the specified acc...
Represents an identity and is the base class for the T:System.Security.Principal.NTAccount and T:Syst...
The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) o...
Serves as the base class for system exceptions namespace.
void ResetAccessRule(AccessRule rule)
Removes all access rules in the Discretionary Access Control List (DACL) associated with this T:Syste...
Represents a security descriptor. A security descriptor includes an owner, a primary group,...
AuthorizationRuleCollection GetAuditRules(bool includeExplicit, bool includeInherited, Type targetType)
Gets a collection of the audit rules associated with the specified security identifier.
void Add(IdentityReference identity)
Adds an T:System.Security.Principal.IdentityReference object to the T:System.Security....
Represents a combination of a user's identity, an access mask, and an access control type (allow or d...
void AddAccessRule(AccessRule rule)
Adds the specified access rule to the Discretionary Access Control List (DACL) associated with this T...
IdentityReference IdentityReference
Gets the T:System.Security.Principal.IdentityReference to which this rule applies.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
bool RemoveAuditRule(AuditRule rule)
Removes audit rules that contain the same security identifier and access mask as the specified audit ...
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
Represents a combination of a user’s identity and an access mask.
AuditFlags AuditFlags
Gets the audit flags for this audit rule.
Controls access to objects without direct manipulation of access control lists (ACLs)....
ControlFlags
These flags affect the security descriptor behavior.
Represents type declarations: class types, interface types, array types, value types,...
void RemoveAuditRuleSpecific(AuditRule rule)
Removes all audit rules that exactly match the specified audit rule from the System Access Control Li...
Represents a collection of T:System.Security.Principal.IdentityReference objects and provides a means...
bool RemoveAccessRule(AccessRule rule)
Removes access rules that contain the same security identifier and access mask as the specified acces...
IdentityReferenceCollection Translate(Type targetType)
Converts the objects in the collection to the specified type. Calling this method is the same as call...
abstract IdentityReference Translate(Type targetType)
Translates the account name represented by the T:System.Security.Principal.IdentityReference object i...
override bool ModifyAudit(AccessControlModification modification, AuditRule rule, out bool modified)
Applies the specified modification to the System Access Control List (SACL) associated with this T:Sy...
AceFlags
Specifies the inheritance and auditing behavior of an access control entry (ACE).
AccessControlType
Specifies whether an T:System.Security.AccessControl.AccessRule object is used to allow or deny acces...
Specifies the discretionary access control list (DACL).
Represents a collection of T:System.Security.AccessControl.AuthorizationRule objects.
InheritanceFlags InheritanceFlags
Gets the value of flags that determine how this rule is inherited by child objects.
The exception that is thrown when one of the arguments provided to a method is not valid.
CommonObjectSecurity(bool isContainer)
Initializes a new instance of the T:System.Security.AccessControl.CommonObjectSecurity class.
Represents an access control list (ACL) and is the base class for the T:System.Security....
AccessControlModification
Specifies the type of access control modification to perform. This enumeration is used by methods of ...
AceQualifier
Specifies the function of an access control entry (ACE).
Represents a security identifier (SID) and provides marshaling and comparison operations for SIDs.
Specifies the system access control list (SACL).
AuthorizationRuleCollection GetAccessRules(bool includeExplicit, bool includeInherited, Type targetType)
Gets a collection of the access rules associated with the specified security identifier.
static readonly byte AclRevision
The revision level of the current T:System.Security.AccessControl.GenericAcl. This value is returned ...
AccessControlType AccessControlType
Gets the T:System.Security.AccessControl.AccessControlType value associated with this T:System....
void RemoveAccessRuleAll(AccessRule rule)
Removes all access rules that have the same security identifier as the specified access rule from the...
void RemoveAccessRuleSpecific(AccessRule rule)
Removes all access rules that exactly match the specified access rule from the Discretionary Access C...
InheritanceFlags
Inheritance flags specify the semantics of inheritance for access control entries (ACEs).
void RemoveAuditRuleAll(AuditRule rule)
Removes all audit rules that have the same security identifier as the specified audit rule from the S...
PropagationFlags PropagationFlags
Gets the value of the propagation flags, which determine how inheritance of this rule is propagated t...
AuditFlags
Specifies the conditions for auditing attempts to access a securable object.