// Token: 0x06001D76 RID: 7542 RVA: 0x00066A5C File Offset: 0x00064C5C internal static bool CanUseQuickCache(CodeGroup group) { ArrayList arrayList = new ArrayList(); arrayList.Add(group); for (int i = 0; i < arrayList.Count; i++) { group = (CodeGroup)arrayList[i]; IUnionSemanticCodeGroup unionSemanticCodeGroup = group as IUnionSemanticCodeGroup; if (unionSemanticCodeGroup == null) { return(false); } if (!PolicyManager.TestPolicyStatement(group.PolicyStatement)) { return(false); } IMembershipCondition membershipCondition = group.MembershipCondition; if (membershipCondition != null && !(membershipCondition is IConstantMembershipCondition)) { return(false); } IList children = group.Children; if (children != null && children.Count > 0) { foreach (object value in children) { arrayList.Add(value); } } } return(true); }
// Here is the managed portion of the QuickCache code. It // is mainly concerned with detecting whether it is valid // for us to use the quick cache, and then calculating the // proper mapping of partial evidence to partial mapping. // // The choice of the partial evidence sets is fairly arbitrary // and in this case is tailored to give us meaningful // results from default policy. // // The choice of whether or not we can use the quick cache // is far from arbitrary. There are a number of conditions that must // be true for the QuickCache to produce valid result. These // are: // // * equivalent evidence objects must produce the same // grant set (i.e. it must be independent of time of day, // space on the harddisk, other "external" factors, and // cannot be random). // // * evidence must be used positively (i.e. if evidence A grants // permission X, then evidence A+B must grant at least permission // X). // // In particular for our implementation, this means that we // limit the classes that can be used by policy to just // the ones defined within mscorlib and that there are // no Exclusive bits set on any code groups. internal static bool CanUseQuickCache(CodeGroup group) { ArrayList list = new ArrayList(); list.Add(group); for (int i = 0; i < list.Count; ++i) { group = (CodeGroup)list[i]; IUnionSemanticCodeGroup unionGroup = group as IUnionSemanticCodeGroup; if (unionGroup != null) { if (!TestPolicyStatement(group.PolicyStatement)) { return(false); } } else { return(false); } IMembershipCondition cond = group.MembershipCondition; if (cond != null && !(cond is IConstantMembershipCondition)) { return(false); } IList children = group.Children; if (children != null && children.Count > 0) { IEnumerator enumerator = children.GetEnumerator(); while (enumerator.MoveNext()) { list.Add(enumerator.Current); } } } return(true); }