System.Security.PermissionSetTriple.UpdateAssert C# (CSharp) Method

UpdateAssert() private method

private UpdateAssert ( PermissionSet in_a ) : PermissionSetTriple
in_a PermissionSet
return PermissionSetTriple
        internal PermissionSetTriple UpdateAssert(PermissionSet in_a)
        {
            PermissionSetTriple retTriple = null;
            if (in_a != null)
            {
                BCLDebug.Assert((!in_a.IsUnrestricted()), "Cannot be unrestricted here");
                // if we're already asserting in_a, nothing to do
                if (in_a.IsSubsetOf(AssertSet))
                    return null;

                PermissionSet retPs;
                if (GrantSet != null)
                    retPs = in_a.Intersect(GrantSet); // Restrict the assert to what we've already been granted
                else
                {
                    GrantSet = new PermissionSet(true);
                    retPs = in_a.Copy(); // Currently unrestricted Grant: assert the whole assert set
                }
                bool bFailedToCompress;
                // removes anything that is already in the refused set from the assert set
                retPs = PermissionSet.RemoveRefusedPermissionSet(retPs, RefusedSet, out bFailedToCompress); 
                if (!bFailedToCompress)
                    bFailedToCompress = PermissionSet.IsIntersectingAssertedPermissions(retPs, AssertSet);
                if (bFailedToCompress)
                {
                    retTriple = new PermissionSetTriple(this);
                    this.Reset();
                    this.GrantSet = retTriple.GrantSet.Copy();
                }

                if (AssertSet == null)
                    AssertSet = retPs;
                else
                    AssertSet.InplaceUnion(retPs);

            }
            return retTriple;
        }
        internal void UpdateGrant(PermissionSet in_g, out ZoneIdentityPermission z,out UrlIdentityPermission u)

Usage Example

Beispiel #1
0
        private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd, bool fDeclarative)
        {
            PermissionSet denials = fsd.GetDenials(fDeclarative);

            if (denials != null)
            {
                currentTriple.UpdateRefused(denials);
            }
            PermissionSet permitOnly = fsd.GetPermitOnly(fDeclarative);

            if (permitOnly != null)
            {
                currentTriple.UpdateGrant(permitOnly);
            }
            if (fsd.GetAssertAllPossible())
            {
                if (currentTriple.GrantSet == null)
                {
                    currentTriple.GrantSet = PermissionSet.s_fullTrust;
                }
                this.UpdateTripleListAndCreateNewTriple(currentTriple, this.m_permSetTriples);
                currentTriple.GrantSet = PermissionSet.s_fullTrust;
                currentTriple.UpdateAssert(fsd.GetAssertions(fDeclarative));
                return(true);
            }
            PermissionSet assertions = fsd.GetAssertions(fDeclarative);

            if (assertions != null)
            {
                if (assertions.IsUnrestricted())
                {
                    if (currentTriple.GrantSet == null)
                    {
                        currentTriple.GrantSet = PermissionSet.s_fullTrust;
                    }
                    this.UpdateTripleListAndCreateNewTriple(currentTriple, this.m_permSetTriples);
                    currentTriple.GrantSet = PermissionSet.s_fullTrust;
                    currentTriple.UpdateAssert(assertions);
                    return(true);
                }
                PermissionSetTriple permissionSetTriple = currentTriple.UpdateAssert(assertions);
                if (permissionSetTriple != null)
                {
                    this.EnsureTriplesListCreated();
                    this.m_permSetTriples.Add((object)permissionSetTriple);
                }
            }
            return(false);
        }
All Usage Examples Of System.Security.PermissionSetTriple::UpdateAssert