diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2005-06-20 20:50:56 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2005-06-20 20:50:56 +0400 |
commit | 42062cff2de948ad32a3f95a0860b578fb17a4f5 (patch) | |
tree | c8142e0b712cedd2345adfb004964c17d87ab4e2 /mcs/class/corlib/System.Security/SecurityManager.cs | |
parent | 28c2d33a74642bb42e273f7a0e6a54e8053ee2bd (diff) |
2005-06-20 Sebastien Pouliot <sebastien@ximian.com>
* CodeAccessPermission.cs: Removed redundant and unrequired TODO.
* PermissionSet.cs: Some 2.0 optimizations (because sets are simpler
without the special case for identity permissions).
* SecurityManager.cs: Shortcut for ResolveIdentityPermissions (in 2.0)
and some more declarative security syntax updates.
svn path=/trunk/mcs/; revision=46249
Diffstat (limited to 'mcs/class/corlib/System.Security/SecurityManager.cs')
-rw-r--r-- | mcs/class/corlib/System.Security/SecurityManager.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs index d14e846429f..8fa6f986a54 100644 --- a/mcs/class/corlib/System.Security/SecurityManager.cs +++ b/mcs/class/corlib/System.Security/SecurityManager.cs @@ -379,7 +379,7 @@ namespace System.Security { return al.GetEnumerator (); } - [SecurityPermission (SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlPolicy)] + [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)] public static void SavePolicy () { IEnumerator e = Hierarchy; @@ -389,7 +389,7 @@ namespace System.Security { } } - [SecurityPermission (SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlPolicy)] + [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)] public static void SavePolicyLevel (PolicyLevel level) { // Yes this will throw a NullReferenceException, just like MS (see FDBK13121) @@ -456,9 +456,13 @@ namespace System.Security { return false; } - // TODO: this changes in 2.0 as identity permissions can now be unrestricted internal static void ResolveIdentityPermissions (PermissionSet ps, Evidence evidence) { +#if NET_2_0 + // in 2.0 identity permissions can now be unrestricted + if (ps.IsUnrestricted ()) + return; +#endif // Only host evidence are used for policy resolution IEnumerator ee = evidence.GetHostEnumerator (); while (ee.MoveNext ()) { @@ -479,17 +483,13 @@ namespace System.Security { { // Permission sets from the runtime (declarative security) can be cached // for performance as they can never change (i.e. they are read-only). + PermissionSet ps = null; - if (_declsecCache == null) { - lock (_lockObject) { - if (_declsecCache == null) { - _declsecCache = new Hashtable (); - } + lock (_lockObject) { + if (_declsecCache == null) { + _declsecCache = new Hashtable (); } - } - PermissionSet ps = null; - lock (_lockObject) { object key = (object) (int) permissions; ps = (PermissionSet) _declsecCache [key]; if (ps == null) { |