From 7612ce0f83b41296fca1c52bc37ad330d39b0315 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Thu, 28 Mar 2019 14:50:51 +0100 Subject: [PATCH] housekeeping - steps to get rid of plone.app.widgets --- plone/app/z3cform/configure.zcml | 6 ++++++ plone/app/z3cform/factories.py | 0 plone/app/z3cform/interfaces.py | 14 ++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 plone/app/z3cform/factories.py diff --git a/plone/app/z3cform/configure.zcml b/plone/app/z3cform/configure.zcml index 09d2c39c..63d81dac 100644 --- a/plone/app/z3cform/configure.zcml +++ b/plone/app/z3cform/configure.zcml @@ -221,4 +221,10 @@ for="z3c.form.interfaces.ITextWidget plone.app.z3cform.interfaces.IPloneFormLayer"/> + + diff --git a/plone/app/z3cform/factories.py b/plone/app/z3cform/factories.py new file mode 100644 index 00000000..e69de29b diff --git a/plone/app/z3cform/interfaces.py b/plone/app/z3cform/interfaces.py index 3ed0e2a5..b4e52d9b 100644 --- a/plone/app/z3cform/interfaces.py +++ b/plone/app/z3cform/interfaces.py @@ -4,6 +4,7 @@ from z3c.form.interfaces import ISelectWidget as IBaseSelectWidget from z3c.form.interfaces import ISingleCheckBoxWidget from z3c.form.interfaces import ITextWidget +from zope.interface import Interface from zope.schema.interfaces import IDate from zope.schema.interfaces import IDatetime @@ -12,6 +13,19 @@ class IPloneFormLayer(IFormLayer): """Request layer installed via browserlayer.xml""" +class IFieldPermissionChecker(Interface): + """Adapter factory for checking whether a user has permission to + edit a specific field on a content object. + """ + + def validate(field_name, vocabulary_name=None): + """Returns True if the current user has permission to edit the + `field_name` field. Returns False if the user does not have + permission. Raises and AttributeError if the field cannot be + found. + """ + + class IDateField(IDate): """Marker interface for the DateField."""