Skip to content

Commit

Permalink
[fc] Repository: plone.restapi
Browse files Browse the repository at this point in the history
Branch: refs/heads/main
Date: 2024-10-31T20:23:30-03:00
Author: Érico Andrei (ericof) <[email protected]>
Commit: plone/plone.restapi@e2d4e70

Fixes Plone Site serialization when there is a field with read_permision set (#1831)

* Fixes Plone Site serialization when there is a field with read_permission set (Fixes #1830)

* Update news/1830.bugfix

---------

Co-authored-by: David Glick &lt;[email protected]&gt;

Files changed:
A news/1830.bugfix
M src/plone/restapi/serializer/site.py
M src/plone/restapi/tests/dxtypes.py
M src/plone/restapi/tests/test_site_serializer.py
  • Loading branch information
ericof committed Oct 31, 2024
1 parent 339c3f3 commit ad516fd
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
Repository: plone.staticresources
Repository: plone.restapi


Branch: refs/heads/master
Date: 2024-10-31T00:06:45+01:00
Author: Peter Mathis (petschki) <[email protected]>
Commit: https://github.com/plone/plone.staticresources/commit/779f13241c52e83d16a170e4743fdb6877962d93
Branch: refs/heads/main
Date: 2024-10-31T20:23:30-03:00
Author: Érico Andrei (ericof) <[email protected]>
Commit: https://github.com/plone/plone.restapi/commit/e2d4e70fa475bd9ccb994af52632c8ef45f76279

Preparing release 2.2.0b1
Fixes Plone Site serialization when there is a field with read_permision set (#1831)

Files changed:
M CHANGES.rst
M setup.py
D news/357.bugfix

b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 32321a504..082564cfb 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -8,6 +8,16 @@ Changelog\n \n .. towncrier release notes start\n \n+2.2.0b1 (2024-10-31)\n+--------------------\n+\n+Bug fixes:\n+\n+\n+- Latest `mockup=5.2.0-beta.0`. See https://github.com/plone/mockup/releases/tag/5.2.0-beta.0\n+ [petschki] (#357)\n+\n+\n 2.2.0a11 (2024-10-24)\n ---------------------\n \ndiff --git a/news/357.bugfix b/news/357.bugfix\ndeleted file mode 100644\nindex 77fb9e877..000000000\n--- a/news/357.bugfix\n+++ /dev/null\n@@ -1,2 +0,0 @@\n-Latest `mockup=5.2.0-beta.0`. See https://github.com/plone/mockup/releases/tag/5.2.0-beta.0\n-[petschki]\ndiff --git a/setup.py b/setup.py\nindex 3c377130a..cfb1013b2 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -11,7 +11,7 @@\n \n setup(\n name="plone.staticresources",\n- version="2.2.0a12.dev0",\n+ version="2.2.0b1",\n description="Static resources for Plone",\n long_description=long_description,\n long_description_content_type="text/x-rst",\n'

Repository: plone.staticresources


Branch: refs/heads/master
Date: 2024-10-31T00:10:48+01:00
Author: Peter Mathis (petschki) <[email protected]>
Commit: https://github.com/plone/plone.staticresources/commit/94a9c710ee270073fe11fee3a34b996a725f07d0

Back to development: 2.2.0b2
* Fixes Plone Site serialization when there is a field with read_permission set (Fixes #1830)

* Update news/1830.bugfix

---------

Co-authored-by: David Glick &lt;[email protected]&gt;

Files changed:
M setup.py
A news/1830.bugfix
M src/plone/restapi/serializer/site.py
M src/plone/restapi/tests/dxtypes.py
M src/plone/restapi/tests/test_site_serializer.py

b'diff --git a/setup.py b/setup.py\nindex cfb1013b2..02e2f9022 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -11,7 +11,7 @@\n \n setup(\n name="plone.staticresources",\n- version="2.2.0b1",\n+ version="2.2.0b2.dev0",\n description="Static resources for Plone",\n long_description=long_description,\n long_description_content_type="text/x-rst",\n'
b'diff --git a/news/1830.bugfix b/news/1830.bugfix\nnew file mode 100644\nindex 000000000..df8dfb81c\n--- /dev/null\n+++ b/news/1830.bugfix\n@@ -0,0 +1 @@\n+Fixed Plone Site serialization when there is a field with read_permission set. @ericof\n\\ No newline at end of file\ndiff --git a/src/plone/restapi/serializer/site.py b/src/plone/restapi/serializer/site.py\nindex 11c5a0a2a..65081fd2e 100644\n--- a/src/plone/restapi/serializer/site.py\n+++ b/src/plone/restapi/serializer/site.py\n@@ -4,15 +4,17 @@\n from plone.dexterity.utils import iterSchemata\n from plone.restapi.batching import HypermediaBatch\n from plone.restapi.bbb import IPloneSiteRoot\n-from plone.restapi.blocks import visit_blocks, iter_block_transform_handlers\n+from plone.restapi.blocks import iter_block_transform_handlers\n+from plone.restapi.blocks import visit_blocks\n+from plone.restapi.interfaces import IBlockFieldSerializationTransformer\n from plone.restapi.interfaces import IFieldSerializer\n from plone.restapi.interfaces import ISerializeToJson\n from plone.restapi.interfaces import ISerializeToJsonSummary\n-from plone.restapi.interfaces import IBlockFieldSerializationTransformer\n from plone.restapi.serializer.converters import json_compatible\n+from plone.restapi.serializer.dxcontent import get_allow_discussion_value\n from plone.restapi.serializer.expansion import expandable_elements\n-from plone.restapi.services.locking import lock_info\n from plone.restapi.serializer.utils import get_portal_type_title\n+from plone.restapi.services.locking import lock_info\n from plone.supermodel.utils import mergedTaggedValueDict\n from Products.CMFCore.utils import getToolByName\n from zope.component import adapter\n@@ -23,7 +25,6 @@\n from zope.interface import Interface\n from zope.schema import getFields\n from zope.security.interfaces import IPermission\n-from plone.restapi.serializer.dxcontent import get_allow_discussion_value\n \n import json\n \n@@ -39,6 +40,7 @@ class SerializeSiteRootToJson:\n def __init__(self, context, request):\n self.context = context\n self.request = request\n+ self.permission_cache = {}\n \n def _build_query(self):\n path = "/".join(self.context.getPhysicalPath())\ndiff --git a/src/plone/restapi/tests/dxtypes.py b/src/plone/restapi/tests/dxtypes.py\nindex b3632d41d..c7f8ef148 100644\n--- a/src/plone/restapi/tests/dxtypes.py\n+++ b/src/plone/restapi/tests/dxtypes.py\n@@ -312,6 +312,9 @@ class ITestBehavior(model.Schema):\n test_behavior_field = schema.TextLine(required=False)\n # Add nav_title to test if it gets substituted in Navigation service\n nav_title = schema.TextLine(required=False)\n+ # Add a field with read permission set\n+ test_secure_field = schema.TextLine(required=False)\n+ read_permission(test_secure_field="cmf.ManagePortal")\n \n \n @provider(IFormFieldProvider)\ndiff --git a/src/plone/restapi/tests/test_site_serializer.py b/src/plone/restapi/tests/test_site_serializer.py\nindex 34174a762..60de5ffff 100644\n--- a/src/plone/restapi/tests/test_site_serializer.py\n+++ b/src/plone/restapi/tests/test_site_serializer.py\n@@ -38,6 +38,7 @@ def setUp(self):\n if fti is not None:\n behavior_list = [a for a in fti.behaviors]\n behavior_list.append("volto.blocks")\n+ behavior_list.append("tests.restapi.test_behavior")\n fti.behaviors = tuple(behavior_list)\n # Invalidating the cache is required for the FTI to be applied\n # on the existing object\n'

0 comments on commit ad516fd

Please sign in to comment.