The Labs \ Source Viewer \ SSCLI \ System.Security \ IPermission

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. // IPermission.cs
  16. //
  17. // Defines the interface that all Permission objects must support.
  18. //
  19. namespace System.Security
  20. {
  21.    
  22.     [System.Runtime.InteropServices.ComVisible(true)]
  23.     public interface IPermission : ISecurityEncodable
  24.     {
  25.         // NOTE: The constants that used to be defined here were moved to
  26.         // PermissionsEnum.cs due to CLS restrictions.
  27.        
  28.         // The integrity of the security system depends on a means to
  29.         // copy objects so that references to sensitive objects are not
  30.         // exposed outside of the runtime. Thus, all permissions must
  31.         // implement Copy.
  32.         //
  33.         // Makes an exact copy of the Permission.
  34.         IPermission Copy();
  35.        
  36. /*
  37.         * Methods to support the Installation, Registration, others... PolicyEngine
  38.         */       
  39.        
  40.         //
  41.         //
  42.         IPermission Intersect(IPermission target);
  43.        
  44.         // The runtime policy manager also requires a means of combining the
  45.         // state contained within two permissions of the same type in a logical OR
  46.         // construct. (The Union of two permission of different type is not defined,
  47.         // except when one of the two is a CompoundPermission of internal type equal
  48.         // to the type of the other permission.)
  49.         //
  50.        
  51.         IPermission Union(IPermission target);
  52.        
  53.         // IsSubsetOf defines a standard mechanism for determining
  54.         // relative safety between two permission demands of the same type.
  55.         // If one demand x demands no more than some other demand y, then
  56.         // x.IsSubsetOf(y) should return true. In this case, if the
  57.         // demand for y is satisfied, then it is possible to assume that
  58.         // the demand for x would also be satisfied under the same
  59.         // circumstances. On the other hand, if x demands something that y
  60.         // does not, then x.IsSubsetOf(y) should return false; the fact
  61.         // that x is satisfied by the current security context does not
  62.         // also imply that the demand for y will also be satisfied.
  63.         //
  64.         // Returns true if 'this' Permission allows no more access than the
  65.         // argument.
  66.         //
  67.         bool IsSubsetOf(IPermission target);
  68.        
  69.         // The Demand method is the fundamental part of the IPermission
  70.         // interface from a component developer's perspective. The
  71.         // permission represents the demand that the developer wants
  72.         // satisfied, and Demand is the means to invoke the demand.
  73.         // For each type of permission, the mechanism to verify the
  74.         // demand will be different. However, to the developer, all
  75.         // permissions invoke that mechanism through the Demand interface.
  76.         // Mark this method as requiring a security object on the caller's frame
  77.         // so the caller won't be inlined (which would mess up stack crawling).
  78.         [DynamicSecurityMethodAttribute()]
  79.         void Demand();
  80.        
  81.     }
  82. }

Developer Fusion