浏览代码

2004-08-30 Sebastien Pouliot <[email protected]>

	* Assembly.cs: Added internal Demand(PermissionSet) for CAS.

svn path=/trunk/mcs/; revision=33059
Sebastien Pouliot 21 年之前
父节点
当前提交
9d8a237ff8
共有 2 个文件被更改,包括 25 次插入0 次删除
  1. 21 0
      mcs/class/corlib/System.Reflection/Assembly.cs
  2. 4 0
      mcs/class/corlib/System.Reflection/ChangeLog

+ 21 - 0
mcs/class/corlib/System.Reflection/Assembly.cs

@@ -730,5 +730,26 @@ namespace System.Reflection {
 			}
 			return true;
 		}
+
+		// Result isn't affected by overrides (like Assert, Deny and PermitOnly)
+		internal bool Demand (PermissionSet ps) 
+		{
+			// have we been explicitely denied this permission ?
+			if (DeniedPermissionSet != null) {
+				if (ps.IsSubsetOf (DeniedPermissionSet)) {
+					return false;
+				}
+			}
+
+			// is it part of the optional permissions requested by the assembly ?
+			if (_optional != null) {
+				// there is! so we can only request a subset of it
+				if (!ps.IsSubsetOf (_optional)) {
+					return false;
+				}
+			}
+
+			return ps.IsSubsetOf (GrantedPermissionSet);
+		}
 	}
 }

+ 4 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,7 @@
+2004-08-30  Sebastien Pouliot  <[email protected]>
+
+	* Assembly.cs: Added internal Demand(PermissionSet) for CAS.
+
 2004-08-30  Zoltan Varga  <[email protected]>
 
 	* MethodBase.cs (GetMethodFromHandle): Avoid passing a valuetype to