[Mono-list] System.Security.Policy.AllMembershipCondition

Dwivedi , Ajay Kumar AjayKumar.Dwivedi@dresdner-bank.com
Sun, 24 Feb 2002 14:16:48 -0000

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

Content-Type: text/plain;

hi all,
	Here is an implementation of
Please Add it to the CVS.

Happy Hacking,
Ajay kumar Dwivedi
#!!!	If anything can go wrong, _FIX_ it. (To hell with MURPHY)
						Dwivedi, Ajay kumar 


Content-Type: application/octet-stream;
Content-Disposition: attachment;

// System.Security.Policy.AllMembershipCondition.cs
// Author:
//   Ajay kumar Dwivedi (adwiv@yahoo.com)

using System;
using System.Security;

namespace System.Security.Policy
	/// <summary>
	/// Summary description for AllMembershipCondition.
	/// </summary>
	public sealed class AllMembershipCondition : IMembershipCondition,
		ISecurityEncodable, ISecurityPolicyEncodable
		// Tag for Xml Data
		private static readonly string XmlTag = "IMembershipCondition";

		public AllMembershipCondition()

		//Always returns true
		public bool Check(Evidence evidence)
			return true;

		public IMembershipCondition Copy()
			return new AllMembershipCondition();

		public override bool Equals(object o)
			if(o is System.Security.Policy.AllMembershipCondition)
				return true;
			return false;
		public void FromXml(SecurityElement e)
			FromXml(e, null);

		//Fixme: is there a need for all this????
		public void FromXml(SecurityElement e, PolicyLevel level)
			if(e == null)
				throw new ArgumentNullException("e");
			if(e.Tag != XmlTag)
				throw new ArgumentException("e","The Tag of SecurityElement must be "
					+ AllMembershipCondition.XmlTag);

		//What's the use of a hashcode here. Equals is always true.
		public override int GetHashCode()
			return 0;

		public override string ToString()
			return "All Code";

		public SecurityElement ToXml()
			return ToXml(null);

		public SecurityElement ToXml(PolicyLevel level)
			SecurityElement se = new SecurityElement(XmlTag);
			Type type = this.GetType();
			string classString = type.FullName + ", " + type.Assembly;
			return se;