// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2001 Nick Drochak, All rights reserved.
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Collections;
using System.Globalization;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace System.Security.Policy {
[Serializable]
+#if NET_2_0
+ [ComVisible (true)]
+#endif
public abstract class CodeGroup {
PolicyStatement m_policy;
IMembershipCondition m_membershipCondition;
string m_description;
string m_name;
ArrayList m_children = new ArrayList();
- PolicyLevel m_level;
+// PolicyLevel m_level;
+#if NET_2_0
+ protected CodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy)
+#else
public CodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy)
+#endif
{
if (null == membershipCondition)
throw new ArgumentNullException ("membershipCondition");
if (null == group)
throw new ArgumentNullException ("group");
- m_children.Add(group);
+ m_children.Add (group.Copy ());
}
public override bool Equals (object o)
{
- if (!(o is CodeGroup))
+ CodeGroup cg = (o as CodeGroup);
+ if (cg == null)
return false;
- return Equals ((CodeGroup)o, false);
+ return Equals (cg, false);
}
public bool Equals (CodeGroup cg, bool compareChildren)
if (cg.Description != this.Description)
return false;
-// FIXME: this compiles with CSC. Didn't succeed at creating a smaller/different test case :(
-// if (!cg.MembershipCondition.Equals (m_membershipCondition))
- if (((object) cg.MembershipCondition).ToString () !=
- ((object) m_membershipCondition).ToString ())
+ if (!cg.MembershipCondition.Equals (m_membershipCondition))
return false;
if (compareChildren) {
ps.FromXml (pset);
}
else {
- ps = new NamedPermissionSet ("Nothing", new PermissionSet (PermissionState.None));
+ ps = new PermissionSet (new PermissionSet (PermissionState.None));
}
}
m_policy = new PolicyStatement (ps);
m_description = e.Attribute("Description");
// seems like we might need this to Resolve() in subclasses
- m_level = level;
+ //m_level = level;
ParseXml (e, level);
}