* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / AuthorizationRuleCollection.cs
index 0602b2e5c62e0eb31e3e349ba781baeda29b8927..78d0da1235194a5ac5520c86ea14f2a8e6bf8ad9 100644 (file)
@@ -47,7 +47,7 @@ namespace System.Web.Configuration {
 
                public void Add (AuthorizationRule rule)
                {
-                       BaseAdd (rule);
+                       BaseAdd (rule, false);
                }
 
                public void Clear ()
@@ -60,7 +60,6 @@ namespace System.Web.Configuration {
                        return new AuthorizationRule (elementName == "allow" ? AuthorizationRuleAction.Allow : AuthorizationRuleAction.Deny);
                }
 
-               [MonoTODO]
                protected override ConfigurationElement CreateNewElement ()
                {
                        return new AuthorizationRule (AuthorizationRuleAction.Allow);
@@ -71,10 +70,11 @@ namespace System.Web.Configuration {
                        return (AuthorizationRule) BaseGet (index);
                }
 
-               [MonoTODO]
                protected override object GetElementKey (ConfigurationElement element)
                {
-                       throw new NotImplementedException ();
+                       AuthorizationRule rule = (AuthorizationRule)element;
+
+                       return rule.Action.ToString();
                }
 
                public int IndexOf (AuthorizationRule rule)
@@ -89,7 +89,7 @@ namespace System.Web.Configuration {
 
                public void Remove (AuthorizationRule rule)
                {
-                       BaseRemove (rule);
+                       BaseRemove (rule.Action.ToString());
                }
 
                public void RemoveAt (int index)
@@ -97,30 +97,34 @@ namespace System.Web.Configuration {
                        BaseRemoveAt (index);
                }
 
-               [MonoTODO]
                public void Set (int index, AuthorizationRule rule)
                {
-                       throw new NotImplementedException ();
+                       if (BaseGet(index) != null)
+                               BaseRemoveAt(index);
+                       BaseAdd(index, rule);
                }
 
-               protected override ConfigurationElementCollectionType CollectionType {
+               public override ConfigurationElementCollectionType CollectionType {
                        get { return ConfigurationElementCollectionType.BasicMapAlternate; }
                }
 
-               [MonoTODO]
+               [MonoTODO ("is it okay to return a comma delimited string here?")]
                protected override string ElementName {
                        get { return "allow,deny"; }
                }
 
                public AuthorizationRule this [int index] {
                        get { return Get (index); }
-                       set {  if (BaseGet(index) != null)  BaseRemoveAt(index);  BaseAdd(index, value); }
+                       set { Set (index, value); }
                }
 
                protected override ConfigurationPropertyCollection Properties {
                        get { return properties; }
                }
 
+               protected override bool ThrowOnDuplicate {
+                       get { return false; }
+               }
        }
 
 }