using System.Configuration;
using System.ComponentModel;
using System.Xml;
+using System.Globalization;
+using System.Web.Util;
-#if NET_2_0
namespace System.Web.Configuration {
static ConfigurationPropertyCollection properties;
AuthorizationRuleAction action;
-
+ ConfigurationSaveMode saveMode = ConfigurationSaveMode.Full;
+
static AuthorizationRule ()
{
rolesProp = new ConfigurationProperty ("roles", typeof (StringCollection), null,
return hashCode;
}
- [MonoTODO]
- protected override bool IsModified ()
+ [MonoTODO ("Not implemented")]
+ protected internal override bool IsModified ()
{
- throw new NotImplementedException ();
+ if (((CommaDelimitedStringCollection)Roles).IsModified || ((CommaDelimitedStringCollection)Users).IsModified || ((CommaDelimitedStringCollection)Verbs).IsModified)
+ return true;
+
+ return false;
}
void VerifyData ()
VerifyData ();
}
- protected override void Reset (ConfigurationElement parentElement)
+ protected internal override void Reset (ConfigurationElement parentElement)
{
AuthorizationRule r = (AuthorizationRule)parentElement;
Action = r.Action;
base.Reset (parentElement);
}
- [MonoTODO]
- protected override void ResetModified ()
+ protected internal override void ResetModified ()
{
base.ResetModified ();
}
- protected override bool SerializeElement (XmlWriter writer, bool serializeCollectionKey)
+ protected internal override bool SerializeElement (XmlWriter writer, bool serializeCollectionKey)
{
+ if (saveMode != ConfigurationSaveMode.Full && !IsModified ())
+ return true;
+
PreSerialize (writer);
writer.WriteStartElement (action == AuthorizationRuleAction.Allow ? "allow" : "deny");
return true;
}
- [MonoTODO]
- protected override void SetReadOnly ()
+ protected internal override void SetReadOnly ()
{
base.SetReadOnly();
}
- [MonoTODO]
- protected override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
+ protected internal override void Unmerge (ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
{
base.Unmerge (sourceElement, parentElement, saveMode);
+ this.saveMode = saveMode;
+
+ AuthorizationRule source = sourceElement as AuthorizationRule;
+ if (source != null)
+ this.action = source.Action;
}
public AuthorizationRuleAction Action {
get { return (StringCollection) base [verbsProp];}
}
- protected override ConfigurationPropertyCollection Properties {
+ protected internal override ConfigurationPropertyCollection Properties {
get { return properties; }
}
internal bool CheckVerb (string verb)
{
foreach (string v in Verbs) {
- if (String.Compare (v, verb, true) == 0)
+ if (String.Compare (v, verb, true, Helpers.InvariantCulture) == 0)
return true;
}
return false;
internal bool CheckUser (string user)
{
foreach (string u in Users) {
- if (String.Compare (u, user, true) == 0 ||
+ if (String.Compare (u, user, true, Helpers.InvariantCulture) == 0 ||
u == "*" ||
(u == "?" && user == ""))
return true;
}
-#endif