public virtual bool ModifyAccessRule(AccessControlModification modification, AccessRule rule, out bool modified)
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }

            if (!AccessRuleType.IsAssignableFrom(rule.GetType()))
            {
                throw new ArgumentException("rule");
            }

            return(ModifyAccess(modification, rule, out modified));
        }
Beispiel #2
0
        private void GetRule(AccessRule rule, JObject jobject, string name, AccessRuleType type)
        {
            var token = jobject[name];

            if (token == null)
            {
                return;
            }
            if (rule.Type != AccessRuleType.Unknown)
            {
                throw new InvalidOperationException("Multiple definition of a rule.");
            }
            if (token.Type != JTokenType.String)
            {
                throw new InvalidOperationException("Rule value is not a string.");
            }
            rule.Type  = type;
            rule.Value = token.Value <string>();
        }