コード例 #1
0
        public WikiAuthorizationRule(AuthorizationRule rule)
        {
            if (rule.Scope != AuthorizationRuleScope.Wiki)
            {
                throw new ArgumentException("Rule must be a wiki-level rule.");
            }

            _action = rule.Action;
            _polarity = rule.Polarity;
            _who = rule.Who;
        }
コード例 #2
0
        void IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
        {
            if (!string.IsNullOrEmpty(reader.NamespaceURI))
            {
                return;
            }

            string type = reader.GetAttribute("Type");

            if (type == StringLiterals.Allow)
            {
                _polarity = AuthorizationRulePolarity.Allow;
            }
            else if (type == StringLiterals.Deny)
            {
                _polarity = AuthorizationRulePolarity.Deny;
            }
            else
            {
                throw new NotSupportedException("Unsupported or missing rule type: " + ((type == null) ? "<<null>>" : type));
            }

            _action = (SecurableAction) Enum.Parse(typeof(SecurableAction), reader.GetAttribute("Action"));
            _who = AuthorizationRuleWho.Parse(reader.GetAttribute("Principal"));
            reader.Read();
        }
コード例 #3
0
 public FlexWikiAuthorizationException(SecurableAction action, AuthorizationRuleScope scope, string name)
 {
     _action = action;
     _scope = scope;
     _name = name;
 }
コード例 #4
0
        private static bool IsValidCombination(AuthorizationRuleWho who, AuthorizationRulePolarity what, AuthorizationRuleScope where,
            SecurableAction permission)
        {
            if ((where == AuthorizationRuleScope.Topic) && (permission == SecurableAction.ManageNamespace))
            {
                return false;
            }

            return true;
        }