[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.
------_=_NextPart_000_01C1BD3D.E5484CE0
Content-Type: text/plain;
charset="iso-8859-1"
hi all,
Here is an implementation of
System.Security.Policy.AllMembershipCondition.
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
<<AllMembershipCondition.cs>>
------_=_NextPart_000_01C1BD3D.E5484CE0
Content-Type: application/octet-stream;
name="AllMembershipCondition.cs"
Content-Disposition: attachment;
filename="AllMembershipCondition.cs"
//
// 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>
[Serializable]
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;
se.AddAttribute("class",classString);
se.AddAttribute("version","1");
return se;
}
}
}
------_=_NextPart_000_01C1BD3D.E5484CE0--