Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2004-08-05 02:19:23 +0400
committerSebastien Pouliot <sebastien@ximian.com>2004-08-05 02:19:23 +0400
commita0534b3aaf6fd4345430d5dd037eccde16b296d0 (patch)
treef9e80711365be8c8c4475f335ec02cac51c50548 /mcs/class/corlib/System.Security.Permissions
parent37246e9536afdf50ca6669bb8421480926627ae4 (diff)
2004-08-04 Sebastien Pouliot <sebastien@ximian.com>
* GacIdentityPermission.cs: New. for NET_2_0 * GacIdentityPermissionAttribute.cs: New. for NET_2_0 svn path=/trunk/mcs/; revision=31906
Diffstat (limited to 'mcs/class/corlib/System.Security.Permissions')
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ChangeLog2
-rw-r--r--mcs/class/corlib/System.Security.Permissions/GacIdentityPermission.cs131
-rw-r--r--mcs/class/corlib/System.Security.Permissions/GacIdentityPermissionAttribute.cs51
3 files changed, 184 insertions, 0 deletions
diff --git a/mcs/class/corlib/System.Security.Permissions/ChangeLog b/mcs/class/corlib/System.Security.Permissions/ChangeLog
index e4acc1ddace..4d5200b75a8 100644
--- a/mcs/class/corlib/System.Security.Permissions/ChangeLog
+++ b/mcs/class/corlib/System.Security.Permissions/ChangeLog
@@ -1,5 +1,7 @@
2004-08-04 Sebastien Pouliot <sebastien@ximian.com>
+ * GacIdentityPermission.cs: New. for NET_2_0
+ * GacIdentityPermissionAttribute.cs: New. for NET_2_0
* ZoneIdentityPermission.cs: NoZone is a subset of all SecurityZone.
2004-08-03 Sebastien Pouliot <sebastien@ximian.com>
diff --git a/mcs/class/corlib/System.Security.Permissions/GacIdentityPermission.cs b/mcs/class/corlib/System.Security.Permissions/GacIdentityPermission.cs
new file mode 100644
index 00000000000..28ec16f44c6
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/GacIdentityPermission.cs
@@ -0,0 +1,131 @@
+//
+// System.Security.Permissions.GacIdentityPermission
+//
+// Author:
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2004 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
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Globalization;
+using System.Security;
+
+namespace System.Security.Permissions {
+
+ [Serializable]
+ public sealed class GacIdentityPermission : CodeAccessPermission, IBuiltInPermission {
+
+ public GacIdentityPermission ()
+ {
+ }
+
+ public GacIdentityPermission (PermissionState state)
+ {
+ switch (state) {
+ case PermissionState.None:
+ break;
+ case PermissionState.Unrestricted:
+ throw new ArgumentException (Locale.GetText (
+ "unrestricted not allowed"));
+ default:
+ throw new ArgumentException (Locale.GetText (
+ "invalid state"));
+ }
+ }
+
+ public override IPermission Copy ()
+ {
+ return (IPermission) new GacIdentityPermission ();
+ }
+
+ public override IPermission Intersect (IPermission target)
+ {
+ if (target == null)
+ return null;
+ if (!(target is GacIdentityPermission)) {
+ throw new ArgumentException (Locale.GetText (
+ "Invalid permission"));
+ }
+ return Copy ();
+ }
+
+ public override bool IsSubsetOf (IPermission target)
+ {
+ if (target == null)
+ return false;
+
+ if (!(target is GacIdentityPermission)) {
+ throw new ArgumentException (Locale.GetText (
+ "Invalid permission"));
+ }
+
+ return true;
+ }
+
+ public override IPermission Union (IPermission target)
+ {
+ if (target == null)
+ return Copy ();
+
+ if (!(target is GacIdentityPermission)) {
+ throw new ArgumentException (Locale.GetText (
+ "Invalid permission"));
+ }
+
+ return Copy ();
+ }
+
+ public override void FromXml (SecurityElement esd)
+ {
+ if (esd == null)
+ throw new ArgumentException ("esd");
+
+ if (esd.Attribute ("version") != "1") {
+ throw new ArgumentException (Locale.GetText (
+ "version attributte is wrong"));
+ }
+
+ // ??? check class name ???
+ }
+
+ public override SecurityElement ToXml ()
+ {
+ SecurityElement se = new SecurityElement ("IPermission");
+ Type t = GetType ();
+ se.AddAttribute ("class", t.FullName + ", " + t.Module.Assembly.FullName);
+ se.AddAttribute ("version", "1");
+ return se;
+ }
+
+ // IBuildInPermission
+
+ int IBuiltInPermission.GetTokenIndex ()
+ {
+ return -1; // TODO
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Security.Permissions/GacIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/GacIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..f2baabdaf02
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/GacIdentityPermissionAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.Security.Permissions.GacIdentityPermissionAttribute
+//
+// Author:
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2004 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
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Security.Permissions {
+
+ [Serializable]
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
+ public sealed class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute {
+
+ public GacIdentityPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ public override IPermission CreatePermission ()
+ {
+ return (IPermission) new GacIdentityPermission ();
+ }
+ }
+}
+
+#endif