dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security PermissionSet


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security PermissionSet.cs, 1.7, 1.8 SecurityManager.cs, 1.5, 1.6
Date: Sat, 23 Aug 2003 22:37:37 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security
In directory subversions:/tmp/cvs-serv10732/runtime/System/Security

Modified Files:
        PermissionSet.cs SecurityManager.cs 
Log Message:


Missing TODO's in the "System.Security" namespace.


Index: PermissionSet.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/PermissionSet.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** PermissionSet.cs    29 May 2003 03:12:58 -0000      1.7
--- PermissionSet.cs    24 Aug 2003 02:37:35 -0000      1.8
***************
*** 26,33 ****
--- 26,39 ----
  
  using System;
+ using System.Text;
+ using System.IO;
+ using System.Globalization;
  using System.Collections;
  using System.Security.Permissions;
  using System.Runtime.Serialization;
+ using System.Runtime.Serialization.Formatters;
+ using System.Runtime.Serialization.Formatters.Binary;
  
+ [Serializable]
  public class PermissionSet : ICollection, IEnumerable, ISecurityEncodable,
                                                         IStackWalk, 
IDeserializationCallback
***************
*** 468,475 ****
  
        // Implement the IDeserializationCallback interface.
-       [TODO]
        void IDeserializationCallback.OnDeserialization(Object sender)
                        {
!                               // TODO
                        }
  
--- 474,480 ----
  
        // Implement the IDeserializationCallback interface.
        void IDeserializationCallback.OnDeserialization(Object sender)
                        {
!                               // Not needed in this implementation.
                        }
  
***************
*** 560,569 ****
  
        // Convert a permission set from one format to another.
-       [TODO]
        public static byte[] ConvertPermissionSet
                                (String inFormat, byte[] inData, String 
outFormat)
                        {
!                               // TODO
!                               return inData;
                        }
  
--- 565,649 ----
  
        // Convert a permission set from one format to another.
        public static byte[] ConvertPermissionSet
                                (String inFormat, byte[] inData, String 
outFormat)
                        {
!                               // Validate the parameters.
!                               if(inFormat == null)
!                               {
!                                       throw new 
ArgumentNullException("inFormat");
!                               }
!                               if(inData == null)
!                               {
!                                       throw new 
ArgumentNullException("inData");
!                               }
!                               if(outFormat == null)
!                               {
!                                       throw new 
ArgumentNullException("outFormat");
!                               }
! 
!                               // Convert the input data into a permission set.
!                               PermissionSet permSet;
!                               SecurityElement e;
!                               
switch(inFormat.ToLower(CultureInfo.InvariantCulture))
!                               {
!                                       case "xml": case "xmlascii":
!                                       {
!                                               permSet = new 
PermissionSet(PermissionState.None);
!                                               e = (new 
MiniXml(Encoding.UTF8.GetString(inData)))
!                                                               .Parse();
!                                               permSet.FromXml(e);
!                                       }
!                                       break;
! 
!                                       case "xmlunicode":
!                                       {
!                                               permSet = new 
PermissionSet(PermissionState.None);
!                                               e = (new 
MiniXml(Encoding.Unicode.GetString(inData)))
!                                                               .Parse();
!                                               permSet.FromXml(e);
!                                       }
!                                       break;
! 
!                               #if CONFIG_SERIALIZATION
!                                       case "binary":
!                                       {
!                                               MemoryStream inStream = new 
MemoryStream(inData);
!                                               permSet = (PermissionSet)
!                                                       ((new 
BinaryFormatter()).Deserialize(inStream));
!                                       }
!                                       break;
!                               #endif
! 
!                                       default: return null;
!                               }
! 
!                               // Convert the output data into a permission 
set.
!                               
switch(outFormat.ToLower(CultureInfo.InvariantCulture))
!                               {
!                                       case "xml": case "xmlascii":
!                                       {
!                                               e = permSet.ToXml();
!                                               return 
Encoding.UTF8.GetBytes(e.ToString());
!                                       }
!                                       // Not reached.
! 
!                                       case "xmlunicode":
!                                       {
!                                               e = permSet.ToXml();
!                                               return 
Encoding.Unicode.GetBytes(e.ToString());
!                                       }
!                                       // Not reached.
! 
!                               #if CONFIG_SERIALIZATION
!                                       case "binary":
!                                       {
!                                               MemoryStream outStream = new 
MemoryStream();
!                                               (new 
BinaryFormatter()).Serialize(outStream, permSet);
!                                               return outStream.ToArray();
!                                       }
!                                       // Not reached.
!                               #endif
!                               }
!                               return null;
                        }
  

Index: SecurityManager.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/SecurityManager.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** SecurityManager.cs  29 May 2003 03:12:58 -0000      1.5
--- SecurityManager.cs  24 Aug 2003 02:37:35 -0000      1.6
***************
*** 27,30 ****
--- 27,31 ----
  using System.Collections;
  using System.Security.Policy;
+ using System.Security.Permissions;
  
  public sealed class SecurityManager
***************
*** 36,48 ****
  
        // Determine if a specific permission has been granted.
-       [TODO]
        public static bool IsGranted(IPermission perm)
                        {
                                if(perm == null)
                                {
                                        return true;
                                }
!                               // TODO
!                               return false;
                        }
  
--- 37,73 ----
  
        // Determine if a specific permission has been granted.
        public static bool IsGranted(IPermission perm)
                        {
+                               // Bail out if the requested permission is null.
                                if(perm == null)
                                {
                                        return true;
                                }
! 
!                               // Get the current permission state.
!                               ClrPermissions current = 
ClrSecurity.GetPermissionsFrom(1);
!                               if(current == null)
!                               {
!                                       // Null is equivalent to "unrestricted".
!                                       return true;
!                               }
! 
!                               // Build a permission set with just this 
permission.
!                               PermissionSet set = new 
PermissionSet(PermissionState.None);
!                               set.AddPermission(perm);
! 
!                               // If "PermitOnly" is set, then only check that 
set.
!                               if(current.permitOnly != null)
!                               {
!                                       return 
set.IsSubsetOf(current.permitOnly);
!                               }
! 
!                               // The permission must be granted, but not 
denied.
!                               if(!set.IsSubsetOf(current.granted) ||
!                                  set.IsSubsetOf(current.denied))
!                               {
!                                       return false;
!                               }
!                               return true;
                        }
  
***************
*** 52,85 ****
  
        // Load policy level information from a file.
-       [TODO]
        public static PolicyLevel LoadPolicyLevelFromFile
                                (String path, PolicyLevelType type)
                        {
!                               // TODO
                                return null;
                        }
  
        // Load policy level information from a string.
-       [TODO]
        public static PolicyLevel LoadPolicyLevelFromString
                                (String str, PolicyLevelType type)
                        {
!                               // TODO
                                return null;
                        }
  
        // Get an enumerator for the policy hierarchy.
-       [TODO]
        public static IEnumerator PolicyHierarchy()
                        {
!                               // TODO
                                return null;
                        }
  
        // Save a particular policy level.
-       [TODO]
        public static void SavePolicyLevel(PolicyLevel level)
                        {
!                               // TODO
                        }
  
--- 77,106 ----
  
        // Load policy level information from a file.
        public static PolicyLevel LoadPolicyLevelFromFile
                                (String path, PolicyLevelType type)
                        {
!                               // Not used in this implementation.
                                return null;
                        }
  
        // Load policy level information from a string.
        public static PolicyLevel LoadPolicyLevelFromString
                                (String str, PolicyLevelType type)
                        {
!                               // Not used in this implementation.
                                return null;
                        }
  
        // Get an enumerator for the policy hierarchy.
        public static IEnumerator PolicyHierarchy()
                        {
!                               // Not used in this implementation.
                                return null;
                        }
  
        // Save a particular policy level.
        public static void SavePolicyLevel(PolicyLevel level)
                        {
!                               // Not used in this implementation.
                        }
  
***************
*** 87,91 ****
  
        // Resolve policy information.
-       [TODO]
        public static PermissionSet ResolvePolicy
                                (Evidence evidence, PermissionSet reqdPset,
--- 108,111 ----
***************
*** 93,104 ****
                                 out PermissionSet denied)
                        {
!                               // TODO
                                denied = null;
                                return null;
                        }
-       [TODO]
        public static PermissionSet ResolvePolicy(Evidence evidence)
                        {
!                               // TODO
                                return null;
                        }
--- 113,123 ----
                                 out PermissionSet denied)
                        {
!                               // Not used in this implementation.
                                denied = null;
                                return null;
                        }
        public static PermissionSet ResolvePolicy(Evidence evidence)
                        {
!                               // Not used in this implementation.
                                return null;
                        }
***************
*** 107,160 ****
  
        // Resolve policy group information.
-       [TODO]
        public static IEnumerator ResolvePolicyGroups(Evidence evidence)
                        {
!                               // TODO
                                return null;
                        }
  
        // Save policy information.
-       [TODO]
        public static void SavePolicy()
                        {
!                               // TODO
                        }
  
        // Get or set the execution rights flag.
-       [TODO]
        public static bool CheckExecutionRights
                        {
                                get
                                {
!                                       // TODO
                                        return true;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
  
        // Determine if security features have been enabled.
-       [TODO]
        public static bool SecurityEnabled
                        {
                                get
                                {
!                                       // TODO
                                        return true;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
  
        // Get the zone and origin information
-       [TODO]
        public static void GetZoneAndOrigin(out ArrayList zone,
                                                                                
out ArrayList origin)
                        {
!                               // TODO
                                zone = null;
                                origin = null;
--- 126,174 ----
  
        // Resolve policy group information.
        public static IEnumerator ResolvePolicyGroups(Evidence evidence)
                        {
!                               // Not used in this implementation.
                                return null;
                        }
  
        // Save policy information.
        public static void SavePolicy()
                        {
!                               // Not used in this implementation.
                        }
  
        // Get or set the execution rights flag.
        public static bool CheckExecutionRights
                        {
                                get
                                {
!                                       // Not used in this implementation.
                                        return true;
                                }
                                set
                                {
!                                       // Not used in this implementation.
                                }
                        }
  
        // Determine if security features have been enabled.
        public static bool SecurityEnabled
                        {
                                get
                                {
!                                       // Not used in this implementation.
                                        return true;
                                }
                                set
                                {
!                                       // Not used in this implementation.
                                }
                        }
  
        // Get the zone and origin information
        public static void GetZoneAndOrigin(out ArrayList zone,
                                                                                
out ArrayList origin)
                        {
!                               // Not used in this implementation.
                                zone = null;
                                origin = null;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]