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/Policy Policy


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Policy PolicyLevel.cs, 1.4, 1.5
Date: Mon, 01 Sep 2003 03:30:35 -0400

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

Modified Files:
        PolicyLevel.cs 
Log Message:


TODO's in "PolicyLevel".


Index: PolicyLevel.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Policy/PolicyLevel.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** PolicyLevel.cs      29 May 2003 03:12:58 -0000      1.4
--- PolicyLevel.cs      1 Sep 2003 07:30:33 -0000       1.5
***************
*** 43,46 ****
--- 43,47 ----
                                fullTrustAssemblies = new ArrayList();
                                namedPermissionSets = new ArrayList();
+                               rootCodeGroup = DefaultRootCodeGroup();
                        }
  
***************
*** 50,54 ****
                                get
                                {
!                                       return fullTrustAssemblies;
                                }
                        }
--- 51,55 ----
                                get
                                {
!                                       return new 
ArrayList(fullTrustAssemblies);
                                }
                        }
***************
*** 64,68 ****
                                get
                                {
!                                       return namedPermissionSets;
                                }
                        }
--- 65,74 ----
                                get
                                {
!                                       ArrayList list = new ArrayList();
!                                       foreach(NamedPermissionSet pSet in 
namedPermissionSets)
!                                       {
!                                               list.Add(pSet.Copy());
!                                       }
!                                       return list;
                                }
                        }
***************
*** 75,79 ****
                                set
                                {
!                                       rootCodeGroup = value;
                                }
                        }
--- 81,89 ----
                                set
                                {
!                                       if(value == null)
!                                       {
!                                               throw new 
ArgumentNullException("value");
!                                       }
!                                       rootCodeGroup = value.Copy();
                                }
                        }
***************
*** 97,104 ****
                                                (sn.PublicKey, sn.Name, 
sn.Version));
                        }
-       [TODO]
        public void AddFullTrustAssembly(StrongNameMembershipCondition snMC)
                        {
!                               // TODO
                        }
  
--- 107,122 ----
                                                (sn.PublicKey, sn.Name, 
sn.Version));
                        }
        public void AddFullTrustAssembly(StrongNameMembershipCondition snMC)
                        {
!                               if(snMC == null)
!                               {
!                                       throw new ArgumentNullException("snMC");
!                               }
!                               if(fullTrustAssemblies.Contains(snMC))
!                               {
!                                       throw new ArgumentException
!                                               
(_("Security_FullTrustPresent"));
!                               }
!                               fullTrustAssemblies.Add(snMC);
                        }
  
***************
*** 116,123 ****
  
        // Change a named permission set.
-       [TODO]
        public NamedPermissionSet ChangeNamedPermissionSet
                                (String name, PermissionSet pSet)
                        {
                                if(name == null)
                                {
--- 134,141 ----
  
        // Change a named permission set.
        public NamedPermissionSet ChangeNamedPermissionSet
                                (String name, PermissionSet pSet)
                        {
+                               // Validate the parameters.
                                if(name == null)
                                {
***************
*** 128,133 ****
                                        throw new ArgumentNullException("pSet");
                                }
!                               // TODO
!                               return null;
                        }
  
--- 146,167 ----
                                        throw new ArgumentNullException("pSet");
                                }
! 
!                               // Find the existing permission set with this 
name.
!                               NamedPermissionSet current = 
GetNamedPermissionSet(name);
!                               if(current == null)
!                               {
!                                       throw new ArgumentException
!                                               
(_("Security_PermissionSetNotFound"));
!                               }
! 
!                               // Make a copy of the previous permission set.
!                               NamedPermissionSet prev =
!                                       (NamedPermissionSet)(current.Copy());
! 
!                               // Clear the permission set and recreate it 
from "pSet".
!                               current.CopyFrom(pSet);
! 
!                               // Return the previsou permission set.
!                               return prev;
                        }
  
***************
*** 150,154 ****
  
        // Remove a named permission set.
-       [TODO]
        public NamedPermissionSet RemoveNamedPermissionSet
                                        (NamedPermissionSet permSet)
--- 184,187 ----
***************
*** 158,173 ****
                                        throw new 
ArgumentNullException("permSet");
                                }
!                               // TODO
!                               return permSet;
                        }
-       [TODO]
        public NamedPermissionSet RemoveNamedPermissionSet(String name)
                        {
                                if(name == null)
                                {
                                        throw new ArgumentNullException("name");
                                }
!                               // TODO
!                               return null;
                        }
  
--- 191,217 ----
                                        throw new 
ArgumentNullException("permSet");
                                }
!                               return RemoveNamedPermissionSet(permSet.Name);
                        }
        public NamedPermissionSet RemoveNamedPermissionSet(String name)
                        {
+                               // Validate the parameter.
                                if(name == null)
                                {
                                        throw new ArgumentNullException("name");
                                }
! 
!                               // Find the existing permission set with this 
name.
!                               NamedPermissionSet current = 
GetNamedPermissionSet(name);
!                               if(current == null)
!                               {
!                                       throw new ArgumentException
!                                               
(_("Security_PermissionSetNotFound"));
!                               }
! 
!                               // Remove the permission set from the list.
!                               namedPermissionSets.Remove(current);
! 
!                               // Return the permission set that was removed.
!                               return current;
                        }
  
***************
*** 194,213 ****
  
        // Remove an entry from the "full trust assembly" list.
-       [TODO]
        public void RemoveFullTrustAssembly(StrongName sn)
                        {
!                               // TODO
                        }
-       [TODO]
        public void RemoveFullTrustAssembly(StrongNameMembershipCondition snMC)
                        {
!                               // TODO
                        }
  
        // Reset to the default state.
-       [TODO]
        public void Reset()
                        {
!                               // TODO
                        }
  
--- 238,284 ----
  
        // Remove an entry from the "full trust assembly" list.
        public void RemoveFullTrustAssembly(StrongName sn)
                        {
!                               if(sn == null)
!                               {
!                                       throw new ArgumentNullException("sn");
!                               }
!                               RemoveFullTrustAssembly
!                                       (new StrongNameMembershipCondition
!                                               (sn.PublicKey, sn.Name, 
sn.Version));
                        }
        public void RemoveFullTrustAssembly(StrongNameMembershipCondition snMC)
                        {
!                               if(snMC == null)
!                               {
!                                       throw new ArgumentNullException("snMC");
!                               }
!                               if(fullTrustAssemblies.Contains(snMC))
!                               {
!                                       fullTrustAssemblies.Remove(snMC);
!                               }
!                               else
!                               {
!                                       throw new ArgumentException
!                                               
(_("Security_FullTrustNotPresent"));
!                               }
!                       }
! 
!       // Create the default root code group.
!       private CodeGroup DefaultRootCodeGroup()
!                       {
!                               UnionCodeGroup group = new UnionCodeGroup
!                                       (new AllMembershipCondition(), null);
!                               group.Name = "All_Code";
!                               group.Description = 
_("Security_RootGroupDescription");
!                               return group;
                        }
  
        // Reset to the default state.
        public void Reset()
                        {
!                               fullTrustAssemblies.Clear();
!                               namedPermissionSets.Clear();
!                               rootCodeGroup = DefaultRootCodeGroup();
                        }
  





reply via email to

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