Skip to content

Commit

Permalink
Merge branch 'main' into erral-issue-1809-main-with-fixed-plone-app-e…
Browse files Browse the repository at this point in the history
…vent
  • Loading branch information
erral authored Oct 20, 2024
2 parents 9316204 + d6815a4 commit cd7973f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions news/1820.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Aliases endpoint: Use "Manage Portal Aliases" and "Manage Content Aliases" permissions. @jackahl
1 change: 1 addition & 0 deletions news/1826.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Site service: Indicate whether the site supports filtering URL aliases by date. @davisagli
14 changes: 7 additions & 7 deletions src/plone/restapi/services/aliases/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
accept="application/json,application/schema+json"
factory=".get.AliasesGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
permission="zope2.View"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>

Expand All @@ -17,7 +17,7 @@
accept="text/csv"
factory=".get.AliasesGet"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
permission="zope2.View"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>

Expand All @@ -26,39 +26,39 @@
accept="application/json,application/schema+json"
factory=".get.AliasesGet"
for="Products.CMFCore.interfaces.IContentish"
permission="zope2.View"
permission="Products.CMFPlone.ManageContextAliases"
name="@aliases"
/>

<plone:service
method="POST"
factory=".add.AliasesPost"
for="*"
permission="cmf.ModifyPortalContent"
permission="Products.CMFPlone.ManageContextAliases"
name="@aliases"
/>

<plone:service
method="POST"
factory=".add.AliasesRootPost"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>

<plone:service
method="DELETE"
factory=".delete.AliasesDelete"
for="*"
permission="cmf.ModifyPortalContent"
permission="Products.CMFPlone.ManageContextAliases"
name="@aliases"
/>

<plone:service
method="DELETE"
factory=".delete.AliasesDelete"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
permission="cmf.ModifyPortalContent"
permission="Products.CMFPlone.ManagePortalAliases"
name="@aliases"
/>

Expand Down
14 changes: 14 additions & 0 deletions src/plone/restapi/services/site/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from Products.CMFPlone.interfaces import IImagingSchema
from Products.CMFPlone.interfaces import ISiteSchema
from Products.CMFPlone.utils import getSiteLogo
from Products.CMFPlone.controlpanel.browser.redirects import RedirectionSet
from zope.component import adapter
from zope.component import getMultiAdapter
from zope.component import getUtility
Expand Down Expand Up @@ -49,6 +50,7 @@ def __call__(self, expand=False):
"plone.default_language": language_settings.default_language,
"plone.available_languages": language_settings.available_languages,
"plone.portal_timezone": self.plone_timezone(),
"features": self.features(),
}
)

Expand All @@ -73,6 +75,18 @@ def plone_timezone(self):

return portal_timezone

def features(self):
"""Indicates which features are supported by this site.
This can be used by a client to check for version-dependent features.
"""
result = {
"filter_aliases_by_date": hasattr(
RedirectionSet, "supports_date_range_filtering"
),
}
return result


class SiteGet(Service):
def reply(self):
Expand Down
3 changes: 3 additions & 0 deletions src/plone/restapi/tests/http-examples/site_get.resp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Content-Type: application/json

{
"@id": "http://localhost:55001/plone/@site",
"features": {
"filter_aliases_by_date": false
},
"plone.allowed_sizes": [
"huge 1600:65536",
"great 1200:65536",
Expand Down

0 comments on commit cd7973f

Please sign in to comment.