// NOTE: This method doesn't show in the class library status page because
// it cannot be "found" with the StrongNameIdentityPermission for ECMA key.
// But it's there!
- [MonoTODO]
+ [MonoTODO ("works for fulltrust (empty), documentation doesn't really make sense, type wise")]
[StrongNameIdentityPermission (SecurityAction.LinkDemand, PublicKey = "0x00000000000000000400000000000000")]
public static void GetZoneAndOrigin (out ArrayList zone, out ArrayList origin)
{
foreach (IPermission p in ps) {
// note: this may contains non CAS permissions
if ((!noncas) && (p is CodeAccessPermission)) {
- if (!SecurityManager.IsGranted (a, p))
+#if NET_2_0
+ if (!IsGranted (a, p))
return p;
+#else
+ if (p is IUnrestrictedPermission) {
+ if (!IsGranted (a, p))
+ return p;
+ } else {
+ if (!IsGrantedRestricted (a, p))
+ return p;
+ }
+#endif
} else {
// but non-CAS will throw on failure...
try {
ResolveIdentityPermissions (ps, evidence);
- // do we have the right to execute ?
- if (CheckExecutionRights) {
- // unless we have "Full Trust"...
- if (!ps.IsUnrestricted ()) {
- // ... we need to find a SecurityPermission
- IPermission security = ps.GetPermission (typeof (SecurityPermission));
- if (!_execution.IsSubsetOf (security)) {
- throw new PolicyException (Locale.GetText (
- "Policy doesn't grant the right to execute to the assembly."));
- }
- }
- }
-
return ps;
}
#if NET_2_0
- [MonoTODO ("more tests are needed")]
+ [MonoTODO ("(2.0) more tests are needed")]
public static PermissionSet ResolvePolicy (Evidence[] evidences)
{
if ((evidences == null) || (evidences.Length == 0) ||
static private SecurityPermission _execution = new SecurityPermission (SecurityPermissionFlag.Execution);
- [MonoTODO()]
public static PermissionSet ResolvePolicy (Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)
{
PermissionSet resolved = ResolvePolicy (evidence);
"Policy doesn't grant the minimal permissions required to execute the assembly."));
}
+ // do we check for execution rights ?
+ if (CheckExecutionRights) {
+ bool execute = false;
+ // an empty permissionset doesn't include Execution
+ if (resolved != null) {
+ // unless we have "Full Trust"...
+ if (resolved.IsUnrestricted ()) {
+ execute = true;
+ } else {
+ // ... we need to find a SecurityPermission
+ IPermission security = resolved.GetPermission (typeof (SecurityPermission));
+ execute = _execution.IsSubsetOf (security);
+ }
+ }
+
+ if (!execute) {
+ throw new PolicyException (Locale.GetText (
+ "Policy doesn't grant the right to execute the assembly."));
+ }
+ }
+
denied = denyPset;
return resolved;
}