[Zope3-checkins] CVS: Zope3/src/zope/app/security - permission.py:1.3 principal.py:1.2 zopepolicy.py:1.3
R. Sean Bowman
sean.bowman@acm.org
Thu, 6 Feb 2003 01:50:21 -0500
Update of /cvs-repository/Zope3/src/zope/app/security
In directory cvs.zope.org:/tmp/cvs-serv18167/zope/app/security
Modified Files:
permission.py principal.py zopepolicy.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/security/permission.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/security/permission.py:1.2 Tue Jan 21 16:21:46 2003
+++ Zope3/src/zope/app/security/permission.py Thu Feb 6 01:49:48 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.2 ===
--- Zope3/src/zope/app/security/principal.py:1.1 Thu Dec 26 13:49:06 2002
+++ Zope3/src/zope/app/security/principal.py Thu Feb 6 01:49:48 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.3 ===
--- Zope3/src/zope/app/security/zopepolicy.py:1.2 Thu Jan 16 10:11:02 2003
+++ Zope3/src/zope/app/security/zopepolicy.py Thu Feb 6 01:49:48 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 = {}