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; }
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(); }
public FlexWikiAuthorizationException(SecurableAction action, AuthorizationRuleScope scope, string name) { _action = action; _scope = scope; _name = name; }
private static bool IsValidCombination(AuthorizationRuleWho who, AuthorizationRulePolarity what, AuthorizationRuleScope where, SecurableAction permission) { if ((where == AuthorizationRuleScope.Topic) && (permission == SecurableAction.ManageNamespace)) { return false; } return true; }