Removes all access control rules with the same user and System.Security.AccessControl.AccessControlType (allow or deny) as the specified rule, and then adds the specified rule.
- rule
- The System.Security.AccessControl.SemaphoreAccessRule to add. The user and System.Security.AccessControl.AccessControlType of this rule determine the rules to remove before this rule is added.
If the specified rule has AccessControlType.Allow, the effect of this method is to remove all AccessControlType.Allow rules for the specified user, replacing them with the specified rule. If the specified rule has AccessControlType.Deny, all AccessControlType.Deny rules for the specified user are replaced with the specified rule.
If there are no rules whose user and System.Security.AccessControl.AccessControlType match the specified rule, rule is added.