[Zope3-checkins] CVS: Zope3/src/zope/app/security - permission.py:1.2.2.1 principal.py:1.1.4.1 zopepolicy.py:1.2.2.1

Sidnei da Silva sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:41:58 -0500


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

Modified Files:
      Tag: paris-copypasterename-branch
	permission.py principal.py zopepolicy.py 
Log Message:
Updating from HEAD to make sure everything still works before merging

=== Zope3/src/zope/app/security/permission.py 1.2 => 1.2.2.1 ===
--- Zope3/src/zope/app/security/permission.py:1.2	Tue Jan 21 16:21:46 2003
+++ Zope3/src/zope/app/security/permission.py	Tue Feb 11 09:41:27 2003
@@ -19,12 +19,13 @@
 from zope.schema import ValueSet
 from zope.schema.interfaces import ValidationError
 from zope.component import getService
+from zope.component.servicenames import Permissions
 from zope.app.interfaces.security import IPermissionField
 
 
 def checkPermission(context, permission_id):
     
-    if not getService(context, 'Permissions').getPermission(permission_id):
+    if not getService(context, Permissions).getPermission(permission_id):
         raise ValueError("Undefined permission id", permission_id)
 
 class PermissionField(ValueSet):
@@ -33,6 +34,6 @@
 
     def _validate(self, value):
         super(PermissionField, self)._validate(value)
-        service = getService(self.context, 'Permissions')
+        service = getService(self.context, Permissions)
         if service.getPermission(value) is None:
             raise ValidationError("Unknown permission", value)


=== Zope3/src/zope/app/security/principal.py 1.1 => 1.1.4.1 ===
--- Zope3/src/zope/app/security/principal.py:1.1	Thu Dec 26 13:49:06 2002
+++ Zope3/src/zope/app/security/principal.py	Tue Feb 11 09:41:27 2003
@@ -18,11 +18,12 @@
 
 from zope.exceptions import NotFoundError
 from zope.component import getService
+from zope.component.servicenames import Authentication
 
 def checkPrincipal(context, principal_id):
 
     try:
-        if getService(context, 'Authentication').getPrincipal(principal_id):
+        if getService(context, Authentication).getPrincipal(principal_id):
             return
     except NotFoundError:
         pass


=== Zope3/src/zope/app/security/zopepolicy.py 1.2 => 1.2.2.1 ===
--- Zope3/src/zope/app/security/zopepolicy.py:1.2	Thu Jan 16 10:11:02 2003
+++ Zope3/src/zope/app/security/zopepolicy.py	Tue Feb 11 09:41:27 2003
@@ -18,7 +18,7 @@
 __version__='$Revision$'[11:-2]
 
 from zope.component import queryAdapter, getService
-
+from zope.component.servicenames import Authentication
 from zope.proxy.context import ContainmentIterator
 
 from zope.exceptions import Unauthorized, Forbidden
@@ -51,7 +51,7 @@
 
 
 def _computeBasePrincipalRoles(principalid, object):
-    auth = getService(object, "Authentication")
+    auth = getService(object, Authentication)
     p = auth.getPrincipal(principalid)
     roles = tuple(p.getRoles()) + ('Anonymous',)
     roledict = {}