[Mono-bugs] [Bug 52693][Wis] Changed - Unsupported declarative permissions

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 4 Mar 2004 20:04:45 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by spouliot@videotron.ca.

http://bugzilla.ximian.com/show_bug.cgi?id=52693

--- shadow/52693	2004-03-04 17:30:27.000000000 -0500
+++ shadow/52693.tmp.864	2004-03-04 20:04:45.000000000 -0500
@@ -174,6 +174,31 @@
 failures).
 
 PrincipalPermissionAttribute can be applied only on Class and Method 
 and supports Demand (checked at runtime), LinkDemand (checked at JIT 
 compilation) and InheritanceDemand (checked at load time).
 
+
+------- Additional Comments From spouliot@videotron.ca  2004-03-04 20:04 -------
+The security attributes are kept in the assembly metadata as XML 
+strings. The XML strings always seems to represent a PermissionSet.
+
+corlib has an internal parser, SecurityParser based on MiniParser, 
+that can return a SecurityElement.
+
+A static method could be added to SecurityParser to return a 
+PermissionSet directly from the XML string.
+
+static PermissionSet FromXmlString (string xml) 
+{
+	SecurityParser sp = new SecurityParser ();
+	sp.LoadXml (xml);
+	PermissionSet ps = new PermissionSet (PermissionState.None);
+	ps.FromXml (sp.ToXml ());
+	return ps;
+}
+
+This should simplify the number of operation required by the runtime 
+to start a SecurityAction, e.g. (in pseudo-code)
+
+PermissionSet ps = SecurityParser.FromXmlString (metadataXML);
+ps.Demand ();