[Zope3-checkins] CVS: Zope3/src/zope/app/security -
configure.zcml:1.16 permission.py:1.13
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Apr 24 19:20:33 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/security
In directory cvs.zope.org:/tmp/cvs-serv30394/src/zope/app/security
Modified Files:
configure.zcml permission.py
Log Message:
Remove PermissionField and its widget in favor of Choice and a vocabulary.
=== Zope3/src/zope/app/security/configure.zcml 1.15 => 1.16 ===
--- Zope3/src/zope/app/security/configure.zcml:1.15 Sun Apr 11 14:16:31 2004
+++ Zope3/src/zope/app/security/configure.zcml Sat Apr 24 19:20:01 2004
@@ -6,10 +6,14 @@
<permission
id="zope.Public"
title="[view-permission] Public"
- description="Special permission indicating unconditional access
-Public resources are always accessable.
-"
+ description="Special permission indicating unconditional access.
+ Public resources are always accessable."
/>
+
+ <vocabulary
+ name="Permissions"
+ factory="zope.app.utility.vocabulary.UtilityVocabulary"
+ interface="zope.app.security.interfaces.IPermission" />
<include file="globalmodules.zcml" />
<include file="_protections.zcml" />
=== Zope3/src/zope/app/security/permission.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/security/permission.py:1.12 Sun Apr 11 14:16:31 2004
+++ Zope3/src/zope/app/security/permission.py Sat Apr 24 19:20:01 2004
@@ -16,11 +16,10 @@
$Id$
"""
from zope.interface import implements
-from zope.schema import Enumerated, Field
from zope.schema.interfaces import ValidationError
from zope.security.checker import CheckerPublic
from zope.app import zapi
-from zope.app.security.interfaces import IPermission, IPermissionField
+from zope.app.security.interfaces import IPermission
class Permission(object):
@@ -38,15 +37,3 @@
return
if not zapi.queryUtility(context, IPermission, name=permission_id):
raise ValueError("Undefined permission id", permission_id)
-
-
-class PermissionField(Enumerated, Field):
- """A field that represents a permission in a schema"""
- implements(IPermissionField)
-
- def _validate(self, value):
- if value is CheckerPublic:
- return
- super(PermissionField, self)._validate(value)
- if zapi.queryUtility(self.context, IPermission, name=value) is None:
- raise ValidationError("Unknown permission", value)
More information about the Zope3-Checkins
mailing list