System.Security.SecurityManager.SecurityManager.ResolvePolicyLevel C# (CSharp) Method

ResolvePolicyLevel() static private method

static private ResolvePolicyLevel ( PermissionSet &ps, PolicyLevel pl, Evidence evidence ) : bool
ps PermissionSet
pl System.Security.Policy.PolicyLevel
evidence System.Security.Policy.Evidence
return bool
		internal static bool ResolvePolicyLevel (ref PermissionSet ps, PolicyLevel pl, Evidence evidence)
		{
			PolicyStatement pst = pl.Resolve (evidence);
			if (pst != null) {
				if (ps == null) {
					// only for initial (first) policy level processed
					ps = pst.PermissionSet;
				} else {
					ps = ps.Intersect (pst.PermissionSet);
					if (ps == null) {
						// null is equals to None - exist that null can throw NullReferenceException ;-)
						ps = new PermissionSet (PermissionState.None);
					}
				}

				if ((pst.Attributes & PolicyStatementAttribute.LevelFinal) == PolicyStatementAttribute.LevelFinal)
					return true;
			}
			return false;
		}