当前位置: 首页>>代码示例>>C#>>正文


C# PolicyStatement.GetPermissionSetNoCopy方法代码示例

本文整理汇总了C#中System.Security.Policy.PolicyStatement.GetPermissionSetNoCopy方法的典型用法代码示例。如果您正苦于以下问题:C# PolicyStatement.GetPermissionSetNoCopy方法的具体用法?C# PolicyStatement.GetPermissionSetNoCopy怎么用?C# PolicyStatement.GetPermissionSetNoCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Policy.PolicyStatement的用法示例。


在下文中一共展示了PolicyStatement.GetPermissionSetNoCopy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InplaceUnion

 internal void InplaceUnion(PolicyStatement childPolicy)
 {
     if (((this.Attributes & childPolicy.Attributes) & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
     {
         throw new PolicyException(Environment.GetResourceString("Policy_MultipleExclusive"));
     }
     if (childPolicy.HasDependentEvidence)
     {
         bool flag = this.m_permSet.IsSubsetOf(childPolicy.GetPermissionSetNoCopy()) && !childPolicy.GetPermissionSetNoCopy().IsSubsetOf(this.m_permSet);
         if (this.HasDependentEvidence || flag)
         {
             if (this.m_dependentEvidence == null)
             {
                 this.m_dependentEvidence = new List<IDelayEvaluatedEvidence>();
             }
             this.m_dependentEvidence.AddRange(childPolicy.DependentEvidence);
         }
     }
     if ((childPolicy.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
     {
         this.m_permSet = childPolicy.GetPermissionSetNoCopy();
         this.Attributes = childPolicy.Attributes;
     }
     else
     {
         this.m_permSet.InplaceUnion(childPolicy.GetPermissionSetNoCopy());
         this.Attributes |= childPolicy.Attributes;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:PolicyStatement.cs

示例2: Resolve

        [System.Security.SecurityCritical]  // auto-generated
        internal PolicyStatement Resolve (Evidence evidence, int count, byte[] serializedEvidence) {
            if (evidence == null)
                throw new ArgumentNullException("evidence");
            Contract.EndContractBlock();

            PolicyStatement policy = null;
            if (serializedEvidence != null)
                policy = CheckCache(count, serializedEvidence);

            if (policy == null) {
                CheckLoaded();

                bool allConst;
                bool isFullTrust = m_fullTrustAssemblies != null && IsFullTrustAssembly(m_fullTrustAssemblies, evidence);
                if (isFullTrust) {
                    policy = new PolicyStatement(new PermissionSet(true), PolicyStatementAttribute.Nothing);
                    allConst = true;
                }
                else {
                    ArrayList list = GenericResolve(evidence, out allConst);
                    policy = new PolicyStatement();
                    // This will set the permission set to the empty set.
                    policy.PermissionSet = null;

                    IEnumerator enumerator = list.GetEnumerator();
                    while (enumerator.MoveNext()) {
                        PolicyStatement ps = ((CodeGroupStackFrame)enumerator.Current).policy;
                        if (ps != null) {
                            policy.GetPermissionSetNoCopy().InplaceUnion(ps.GetPermissionSetNoCopy());
                            policy.Attributes |= ps.Attributes;

                            // If we find a policy statement that's dependent upon unverified evidence, we
                            // need to mark that as used so that the VM can potentially force verification on
                            // the evidence.
                            if (ps.HasDependentEvidence) {
                                foreach (IDelayEvaluatedEvidence delayEvidence in ps.DependentEvidence) {
                                    delayEvidence.MarkUsed();
                                }
                            }
                        }
                    }
                }
                if (allConst) {
                    // We want to store in the cache the evidence that was touched during policy evaluation
                    // rather than the input serialized evidence, since that evidence is optimized for the
                    // standard policy and is not all-inclusive.  We need to make sure that any evidence
                    // used to determine the grant set is added to the cache key.
                    Cache(count, evidence.RawSerialize(), policy);
                }
            }

            return policy;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:54,代码来源:PolicyLevel.cs

示例3: InplaceUnion

        /// <summary>
        ///     Union a child policy statement into this policy statement
        /// </summary>
        internal void InplaceUnion(PolicyStatement childPolicy)
        {
            BCLDebug.Assert(childPolicy != null, "childPolicy != null");

            if (((Attributes & childPolicy.Attributes) & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
            {
                throw new PolicyException(Environment.GetResourceString( "Policy_MultipleExclusive" ));
            }

#if FEATURE_CAS_POLICY
            // If our code group generated a grant set based upon unverified evidence, or it generated a grant
            // set strictly less than that of a child group based upon unverified evidence, we need to keep
            // track of any unverified evidence our child group has.
            if (childPolicy.HasDependentEvidence)
            {
                bool childEvidenceNeedsVerification = m_permSet.IsSubsetOf(childPolicy.GetPermissionSetNoCopy()) &&
                                                      !childPolicy.GetPermissionSetNoCopy().IsSubsetOf(m_permSet);

                if (HasDependentEvidence || childEvidenceNeedsVerification)
                {
                    if (m_dependentEvidence == null)
                    {
                        m_dependentEvidence = new List<IDelayEvaluatedEvidence>();
                    }

                    m_dependentEvidence.AddRange(childPolicy.DependentEvidence);
                }
            }
#endif

            // We need to merge together our grant set and attributes.  The result of this merge is
            // dependent upon if we're merging a child marked exclusive or not.  If the child is not
            // exclusive, we need to union in its grant set and or in its attributes. However, if the child
            // is exclusive then it is the only code group which should have an effect on the resulting
            // grant set and therefore our grant should be ignored.
            if ((childPolicy.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
            {
                m_permSet = childPolicy.GetPermissionSetNoCopy();
                Attributes = childPolicy.Attributes;
            }
            else
            {
                m_permSet.InplaceUnion(childPolicy.GetPermissionSetNoCopy());
                Attributes = Attributes | childPolicy.Attributes;
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:49,代码来源:policystatement.cs

示例4: Resolve

 internal PolicyStatement Resolve(Evidence evidence, int count, byte[] serializedEvidence)
 {
     if (evidence == null)
     {
         throw new ArgumentNullException("evidence");
     }
     PolicyStatement policy = null;
     if (serializedEvidence != null)
     {
         policy = this.CheckCache(count, serializedEvidence);
     }
     if (policy == null)
     {
         bool flag;
         this.CheckLoaded();
         if ((this.m_fullTrustAssemblies != null) && IsFullTrustAssembly(this.m_fullTrustAssemblies, evidence))
         {
             policy = new PolicyStatement(new PermissionSet(true), PolicyStatementAttribute.Nothing);
             flag = true;
         }
         else
         {
             ArrayList list = this.GenericResolve(evidence, out flag);
             policy = new PolicyStatement {
                 PermissionSet = null
             };
             IEnumerator enumerator = list.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 PolicyStatement statement2 = ((CodeGroupStackFrame) enumerator.Current).policy;
                 if (statement2 != null)
                 {
                     policy.GetPermissionSetNoCopy().InplaceUnion(statement2.GetPermissionSetNoCopy());
                     policy.Attributes |= statement2.Attributes;
                     if (statement2.HasDependentEvidence)
                     {
                         foreach (IDelayEvaluatedEvidence evidence2 in statement2.DependentEvidence)
                         {
                             evidence2.MarkUsed();
                         }
                     }
                 }
             }
         }
         if (flag)
         {
             this.Cache(count, evidence.RawSerialize(), policy);
         }
     }
     return policy;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:51,代码来源:PolicyLevel.cs

示例5: InplaceUnion

        /// <summary>
        ///     Union a child policy statement into this policy statement
        /// </summary>
        internal void InplaceUnion(PolicyStatement childPolicy)
        {
            BCLDebug.Assert(childPolicy != null, "childPolicy != null");

            if (((Attributes & childPolicy.Attributes) & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
            {
                throw new PolicyException(Environment.GetResourceString( "Policy_MultipleExclusive" ));
            }

            // We need to merge together our grant set and attributes.  The result of this merge is
            // dependent upon if we're merging a child marked exclusive or not.  If the child is not
            // exclusive, we need to union in its grant set and or in its attributes. However, if the child
            // is exclusive then it is the only code group which should have an effect on the resulting
            // grant set and therefore our grant should be ignored.
            if ((childPolicy.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
            {
                m_permSet = childPolicy.GetPermissionSetNoCopy();
                Attributes = childPolicy.Attributes;
            }
            else
            {
                m_permSet.InplaceUnion(childPolicy.GetPermissionSetNoCopy());
                Attributes = Attributes | childPolicy.Attributes;
            }
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:28,代码来源:PolicyStatement.cs

示例6: Resolve

        internal PolicyStatement Resolve (Evidence evidence, int count, char[] serializedEvidence) {
            if (evidence == null)
                throw new ArgumentNullException("evidence");

            PolicyStatement policy = null;
            if (serializedEvidence != null)
                policy = CheckCache(count, serializedEvidence);

            if (policy == null) {
                CheckLoaded();

                bool allConst;
                bool isFullTrust = m_fullTrustAssemblies != null && IsFullTrustAssembly(m_fullTrustAssemblies, evidence);
                if (isFullTrust) {
                    policy = new PolicyStatement(new PermissionSet(true), PolicyStatementAttribute.Nothing);
                    allConst = true;
                }
                else {
                    ArrayList list = GenericResolve(evidence, out allConst);
                    policy = new PolicyStatement();
                    // This will set the permission set to the empty set.
                    policy.PermissionSet = null;

                    IEnumerator enumerator = list.GetEnumerator();
                    while (enumerator.MoveNext()) {
                        PolicyStatement ps = ((CodeGroupStackFrame)enumerator.Current).policy;
                        if (ps != null) {
                            policy.GetPermissionSetNoCopy().InplaceUnion(ps.GetPermissionSetNoCopy());
                            policy.Attributes |= ps.Attributes;
                        }
                    }
                }
                if (allConst && serializedEvidence != null)
                    Cache(count, serializedEvidence, policy);
            }

            return policy;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:38,代码来源:policylevel.cs

示例7: CombinePolicy

        private void CombinePolicy( PolicyStatement left, PolicyStatement right )
        {
#if _DEBUG
            if (debug)
            {
                DEBUG_OUT( "left = \n" + (left == null ? "<null>" : left.ToXml().ToString() ) );
                DEBUG_OUT( "right = \n" + (right == null ? "<null>" : right.ToXml().ToString() ) );
            } 
#endif
            if (right == null)
            {
                return;
            }
            else
            {
                // An exception somewhere in here means that a permission
                // failed some operation.  This simply means that it will be
                // dropped from the grant set which is safe operation that
                // can be ignored.
                
                try
                {
                    left.GetPermissionSetNoCopy().InplaceUnion( right.GetPermissionSetNoCopy() );
                }
                catch (Exception)
                {
                }
                left.Attributes = left.Attributes | right.Attributes;
            }

#if _DEBUG
            if (debug)          
                DEBUG_OUT( "outcome =\n" + left.ToXml().ToString() );
#endif
        }
开发者ID:ArildF,项目名称:masters,代码行数:35,代码来源:policylevel.cs


注:本文中的System.Security.Policy.PolicyStatement.GetPermissionSetNoCopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。