Beispiel #1
0
        private static void ReflectionTargetDemandHelper(int permission, PermissionSet targetGrant, CompressedStack securityContext)
        {
            PermissionSet permissionSet;

            if (targetGrant == null)
            {
                permissionSet = new PermissionSet(PermissionState.Unrestricted);
            }
            else
            {
                permissionSet = targetGrant.CopyWithNoIdentityPermissions();
                permissionSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
            }
            securityContext.DemandFlagsOrGrantSet(1 << permission, permissionSet);
        }
        [System.Security.SecurityCritical]  // auto-generated
        private static void ReflectionTargetDemandHelper(int permission,
                                                         PermissionSet targetGrant,
                                                         CompressedStack securityContext)
        {
            Contract.Assert(securityContext != null, "securityContext != null");

            // We need to remove all identity permissions from the grant set of the target, otherwise the
            // disjunctive demand will fail unless we're reflecting on the same assembly.
            PermissionSet demandSet = null;

            if (targetGrant == null)
            {
                demandSet = new PermissionSet(PermissionState.Unrestricted);
            }
            else
            {
                demandSet = targetGrant.CopyWithNoIdentityPermissions();
                demandSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
            }

            securityContext.DemandFlagsOrGrantSet((1 << (int)permission), demandSet);
        }
        [System.Security.SecurityCritical]  // auto-generated
        private static void ReflectionTargetDemandHelper(int permission,
                                                         PermissionSet targetGrant,
                                                         CompressedStack securityContext)
        {
            Contract.Assert(securityContext != null, "securityContext != null");

            // We need to remove all identity permissions from the grant set of the target, otherwise the
            // disjunctive demand will fail unless we're reflecting on the same assembly.
            PermissionSet demandSet = null;
            if (targetGrant == null)
            {
                demandSet = new PermissionSet(PermissionState.Unrestricted);
            }
            else
            {
                demandSet = targetGrant.CopyWithNoIdentityPermissions();
                demandSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
            }

            securityContext.DemandFlagsOrGrantSet((1 << (int)permission), demandSet);
        }
 [System.Security.SecurityCritical]  // auto-generated
 private static void CheckGrantSetHelper(PermissionSet grantSet)
 {
     Contract.Assert(grantSet != null, "Missing grant set");
     grantSet.CopyWithNoIdentityPermissions().Demand();
 }
Beispiel #5
0
 private static void CheckGrantSetHelper(PermissionSet grantSet)
 {
     grantSet.CopyWithNoIdentityPermissions().Demand();
 }
 [System.Security.SecurityCritical]  // auto-generated
 private static void CheckGrantSetHelper(PermissionSet grantSet)
 {
     Contract.Assert(grantSet != null, "Missing grant set");
     grantSet.CopyWithNoIdentityPermissions().Demand();
 }
 private static void CheckGrantSetHelper(PermissionSet grantSet)
 {
     grantSet.CopyWithNoIdentityPermissions().Demand();
 }
 private static void ReflectionTargetDemandHelper(int permission, PermissionSet targetGrant, CompressedStack securityContext)
 {
     PermissionSet grantSet = null;
     if (targetGrant == null)
     {
         grantSet = new PermissionSet(PermissionState.Unrestricted);
     }
     else
     {
         grantSet = targetGrant.CopyWithNoIdentityPermissions();
         grantSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess));
     }
     securityContext.DemandFlagsOrGrantSet(((int) 1) << permission, grantSet);
 }