Skip to content

Commit

Permalink
Merge branch 'master' into unify-expired-and-excluded-items-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Oct 3, 2017
2 parents c85659f + 88a6779 commit 2944b9b
Show file tree
Hide file tree
Showing 37 changed files with 984 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -17,6 +17,7 @@
/.Python
/include
/lib
/local
/.mr.developer.cfg
*.mo
docs/Makefile
Expand Down
42 changes: 32 additions & 10 deletions CHANGES.rst
@@ -1,27 +1,49 @@
Changelog
=========

1.0a21 (unreleased)
1.0a22 (unreleased)
-------------------

- Show expired content when GET on a folderish object, include a way to display
it on @search via the show_inactive parameter
[sneridagh]

- Strip spaces from TextLine values to match z3c.form implementation.
[jaroel]

- Disallow None and u'' when TextLine is required. Refs #351.
[jaroel]


1.0a21 (2017-09-23)
-------------------

New Features:

- Add support for expandable elements.
- Add support for expandable elements. See http://plonerestapi.readthedocs.io/en/latest/expansion.html for details.
[buchi]

- Translate titles in @workflow.
[csenger]

- Add skipped tests from @breadcrumbs and @navigation now that the expansion is in place
[sneridagh]

- Show expired content when GET on a folderish object, include a way to display
it on @search via the show_inactive parameter
[sneridagh]

- Add endpoints for locking/unlocking.
- Add endpoints for locking/unlocking. See http://plonerestapi.readthedocs.io/en/latest/locking.html for details.
[buchi]

- Add @controlpanels endpoint.
[jaroel, timo]

Bugfixes:

- Fix ZCML load order issue by explicitly loading permissions.zcml from CMFCore.
[lgraf]

- Fix @id values returned by @search with 'fullobjects' option
[ebrehault]

- Re-add skipped tests from @breadcrumbs and @navigation now that expansion
is in place.
[sneridagh]


1.0a20 (2017-07-24)
-------------------
Expand Down
5 changes: 4 additions & 1 deletion base.cfg
Expand Up @@ -68,7 +68,10 @@ flake8-extensions =
flake8-coding
flake8-debugger
flake8-print

# additional pep8/flake8 rules, see docs for details
# https://pep8.readthedocs.io/en/1.4.6/intro.html#error-codes
# - E123: closing bracket does not match indentation of opening bracket’s line
flake8-select = E123

[dependencychecker]
recipe = zc.recipe.egg
Expand Down
3 changes: 3 additions & 0 deletions docs/source/_json/controlpanels_get.req
@@ -0,0 +1,3 @@
GET /plone/@controlpanels HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
15 changes: 15 additions & 0 deletions docs/source/_json/controlpanels_get.resp
@@ -0,0 +1,15 @@
HTTP/1.1 200 OK
Content-Type: application/json

[
{
"@id": "http://localhost:55001/plone/@controlpanels/mail",
"group": "General",
"title": "Mail"
},
{
"@id": "http://localhost:55001/plone/@controlpanels/editing",
"group": "Content",
"title": "Editing"
}
]
3 changes: 3 additions & 0 deletions docs/source/_json/controlpanels_get_item.req
@@ -0,0 +1,3 @@
GET /plone/@controlpanels/editing HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
98 changes: 98 additions & 0 deletions docs/source/_json/controlpanels_get_item.resp
@@ -0,0 +1,98 @@
HTTP/1.1 200 OK
Content-Type: application/json

{
"@id": "http://localhost:55001/plone/@controlpanel/editing",
"data": {
"available_editors": [
"TinyMCE",
"None"
],
"default_editor": "TinyMCE",
"enable_link_integrity_checks": true,
"ext_editor": false,
"lock_on_ttw_edit": true
},
"group": "Content",
"schema": {
"fieldsets": [
{
"fields": [
"available_editors",
"default_editor",
"ext_editor",
"enable_link_integrity_checks",
"lock_on_ttw_edit"
],
"id": "default",
"title": "Default"
}
],
"properties": {
"available_editors": {
"additionalItems": true,
"default": [
"TinyMCE",
"None"
],
"description": "Available editors in the portal.",
"items": {
"description": "",
"title": "",
"type": "string"
},
"title": "Available editors",
"type": "array",
"uniqueItems": false
},
"default_editor": {
"choices": [
[
"TinyMCE",
"TinyMCE"
],
[
"None",
"None"
]
],
"default": "TinyMCE",
"description": "Select the default wysiwyg editor. Users will be able to choose their own or select to use the site default.",
"enum": [
"TinyMCE",
"None"
],
"enumNames": [
"TinyMCE",
"None"
],
"title": "Default editor",
"type": "string"
},
"enable_link_integrity_checks": {
"default": true,
"description": "Determines if the users should get warnings when they delete or move content that is linked from inside the site.",
"title": "Enable link integrity checks",
"type": "boolean"
},
"ext_editor": {
"default": false,
"description": "Determines if the external editor feature is enabled. This feature requires a special client-side application installed. The users also have to enable this in their preferences.",
"title": "Enable External Editor feature",
"type": "boolean"
},
"lock_on_ttw_edit": {
"default": true,
"description": "Disabling locking here will only affect users editing content through the Plone web UI. Content edited via WebDAV clients will still be subject to locking.",
"title": "Enable locking for through-the-web edits",
"type": "boolean"
}
},
"required": [
"available_editors",
"default_editor"
],
"type": "object"
},
"title": "Editing"
}
9 changes: 9 additions & 0 deletions docs/source/_json/controlpanels_patch.req
@@ -0,0 +1,9 @@
PATCH /plone/@controlpanels/editing HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json

{
"default_editor": "CKeditor",
"ext_editor": true
}
Empty file.
77 changes: 77 additions & 0 deletions docs/source/controlpanels.rst
@@ -0,0 +1,77 @@
Control Panels
==============

Control panels in Plone allow you to configure the global site setup of a
Plone site. The @controlpanels endpoint in plone.restapi allows you to list
all existing control panels in a Plone site and to retrieve or edit the
settings of a specific control panel.

Most of the settings in the Plone control panels are based on plone.registry (since Plone 5.x). Therefore you can also use the @registry endpoint to
retrieve or manipulate site settings. The @controlpanels endpoint just gives
developers are more a convenience way of accessing the settings and makes it
easier to render control panels on the front-end.


.. note:: This is currently only implemented for Plone 5.


Listing Control Panels
----------------------

A list of all existing control panels in the portal can be retrieved by
sending a GET request to the @controlpanels endpoint:

.. http:example:: curl httpie python-requests
:request: _json/controlpanels_get.req

Response:

.. literalinclude:: _json/controlpanels_get.resp
:language: http

The following fields are returned:

- @id: hypermedia link to the control panel
- title: the title of the control panel
- group: the group where the control panel should show up (e.g. General, Content, Users, Security, Advanced, Add-on Configuration)


Retrieve a single Control Panel
-------------------------------

To retrieve a single control panel, send a GET request to the URL of the
control panel:

.. http:example:: curl httpie python-requests
:request: _json/controlpanels_get_item.req

Response:

.. literalinclude:: _json/controlpanels_get_item.resp
:language: http


The following fields are returned:

- @id: hypermedia link to the control panel
- title: title of the control panel
- group: group name of the control panel
- schema: JSON Schema of the control panel
- data: current values of the control panel


Updating a Control Panel with PATCH
-----------------------------------

To update the settings on a control panel send a PATCH request to control panel
resource:

.. http:example:: curl httpie python-requests
:request: _json/controlpanels_patch.req

A successful response to a PATCH request will be indicated by a :term:`204 No Content` response:

HTTP/1.1 204 No Content

.. literalinclude:: _json/controlpanels_patch.resp
:language: http
1 change: 1 addition & 0 deletions docs/source/index.rst
Expand Up @@ -42,6 +42,7 @@ Contents
searching
tusupload
vocabularies
controlpanels
customization
conventions

Expand Down
2 changes: 2 additions & 0 deletions docs/source/users.rst
Expand Up @@ -41,6 +41,8 @@ To create a new user, send a ``POST`` request to the global ``/@users`` endpoint
.. note::
By default, "username", and "password" are required fields. If email login is enabled, "email" and "password" are required fields. All other fields in the example are optional.

The field "username" is **not allowed** when email login is *enabled*.

If the user has been created successfully, the server will respond with a status 201 (Created). The ``Location`` header contains the URL of the newly created user and the resource representation in the payload:

.. literalinclude:: _json/users_created.resp
Expand Down
2 changes: 1 addition & 1 deletion setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

version = '1.0a20'
version = '1.0a22.dev0'

long_description = (
open('README.rst').read() + '\n' +
Expand Down

0 comments on commit 2944b9b

Please sign in to comment.