[Zope3-checkins] CVS: Zope3/src/zope/app/browser/security/grants - principalpermissionview.py:1.3 principalroleview.py:1.3 rolepermissionview.py:1.4

R. Sean Bowman sean.bowman@acm.org
Thu, 6 Feb 2003 01:50:42 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/security/grants
In directory cvs.zope.org:/tmp/cvs-serv18167/zope/app/browser/security/grants

Modified Files:
	principalpermissionview.py principalroleview.py 
	rolepermissionview.py 
Log Message:
finished changing service names to use strings defined in
zope/component/servicenames.py, changed the name of
ErrorReportingService to ErrorReports and Resources to ResourceService


=== Zope3/src/zope/app/browser/security/grants/principalpermissionview.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/security/grants/principalpermissionview.py:1.2	Wed Dec 25 09:12:34 2002
+++ Zope3/src/zope/app/browser/security/grants/principalpermissionview.py	Thu Feb  6 01:49:06 2003
@@ -22,6 +22,7 @@
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.security.settings import Allow, Deny, Unset
 from zope.component import getService, getAdapter
+from zope.component.servicenames import Permissions, Authentication
 from zope.publisher.browser import BrowserView
 
 
@@ -30,11 +31,11 @@
     index = ViewPageTemplateFile('pt/principal_permission_edit.pt')
 
     def get_permission_service(self):
-        return getService(self.context, 'Permissions')
+        return getService(self.context, Permissions)
 
     def get_principal(self, principal_id):
         return getService(self.context,
-                          'Authentication'
+                          Authentication
                           ).getPrincipal(principal_id)
 
     def unsetPermissions(self, principal_id, permission_ids, REQUEST=None):
@@ -83,7 +84,7 @@
 
         ppmap = getAdapter(self.context, IPrincipalPermissionMap)
         principal = self.get_principal(principal_id)
-        perm_serv = getService(self.context, 'Permissions')
+        perm_serv = getService(self.context, Permissions)
         result = []
         for perm in perm_serv.getPermissions():
             if ppmap.getSetting(perm, principal) == Unset:


=== Zope3/src/zope/app/browser/security/grants/principalroleview.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/security/grants/principalroleview.py:1.2	Wed Dec 25 09:12:34 2002
+++ Zope3/src/zope/app/browser/security/grants/principalroleview.py	Thu Feb  6 01:49:06 2003
@@ -26,6 +26,7 @@
 from zope.app.security.settings import Unset, Deny, Allow
 from zope.component import getService, getAdapter
 from zope.component.contextdependent import ContextDependent
+from zope.component.servicenames import Authentication, Roles
 from zope.publisher.browser import BrowserView
 
 
@@ -37,14 +38,14 @@
         principals = getattr(self, '_principals', None)
         if principals is None:
             principals = self._principals = getService(
-                self.context, 'Authentication'
+                self.context, Authentication
                 ).getPrincipals('')
         return principals
 
     def getAllRoles(self):
         roles = getattr(self, '_roles', None)
         if roles is None:
-            roles = self._roles = getService(self.context, 'Roles'
+            roles = self._roles = getService(self.context, Roles
                 ).getRoles()
         return roles
 
@@ -55,7 +56,7 @@
                 principals = self.getAllPrincipals()
             else:
                 # Ugh, we have ids, but we want objects
-                auth_service = getService(self.context, 'Authentication')
+                auth_service = getService(self.context, Authentication)
                 principals = [auth_service.getPrincipal(principal)
                               for principal in principals]
 
@@ -66,7 +67,7 @@
                 roles = self.getAllRoles()
             else:
                 # Ugh, we have ids, but we want objects
-                role_service = getService(self.context, 'Roles')
+                role_service = getService(self.context, Roles)
                 roles = [role_service.getRole(role)
                          for role in roles]
 


=== Zope3/src/zope/app/browser/security/grants/rolepermissionview.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/security/grants/rolepermissionview.py:1.3	Thu Dec 26 13:50:45 2002
+++ Zope3/src/zope/app/browser/security/grants/rolepermissionview.py	Thu Feb  6 01:49:06 2003
@@ -23,6 +23,7 @@
 from zope.app.security.grants.rolepermission import RolePermissions
 from zope.app.security.settings import Unset, Allow, Deny
 from zope.component import getService, getAdapter
+from zope.component.servicenames import Roles, Permissions
 from zope.publisher.browser import BrowserView
 
 
@@ -36,7 +37,7 @@
         roles = getattr(self, '_roles', None)
         if roles is None:
             roles = self._roles = getService(
-                self.context, 'Roles'
+                self.context, Roles
                 ).getRoles()
         return roles
 
@@ -44,7 +45,7 @@
         permissions = getattr(self, '_permissions', None)
         if permissions is None:
             permissions = self._permissions = getService(
-                self.context, 'Permissions'
+                self.context, Permissions
                 ).getPermissions()
         return permissions
 
@@ -67,14 +68,14 @@
     def permissionForID(self, pid):
         context = self.context
         roles = self.roles()
-        perm = getService(context, 'Permissions'
+        perm = getService(context, Permissions
                           ).getPermission(pid)
         return PermissionRoles(perm, context, roles)
 
     def roleForID(self, rid):
         context = self.context
         permissions = self.permissions()
-        role = getService(context, 'Roles'
+        role = getService(context, Roles
                           ).getRole(rid)
         return RolePermissions(role, context, permissions)