From 9e6854cf1728874adfdf82b0c9e60ec1196e0d9e Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Fri, 16 Jun 2023 10:08:04 +0200 Subject: [PATCH 1/8] Remove dublicated information Subchapter "Create a New Role in a Dataverse Collection" with the same content in chapter "Dataverse Collection" --- doc/sphinx-guides/source/api/native-api.rst | 33 --------------------- 1 file changed, 33 deletions(-) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 369e92ba129..70bca7e65a7 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -3014,39 +3014,6 @@ Optionally, you may use a third query parameter "sendEmailNotification=false" to Roles ----- -Create a New Role in a Dataverse Collection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Creates a new role under Dataverse collection ``id``. Needs a json file with the role description: - -.. code-block:: bash - - export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - export SERVER_URL=https://demo.dataverse.org - export ID=root - - curl -H X-Dataverse-key:$API_TOKEN -X POST -H "Content-type:application/json" $SERVER_URL/api/dataverses/$ID/roles --upload-file roles.json - -The fully expanded example above (without environment variables) looks like this: - -.. code-block:: bash - - curl -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -X POST -H "Content-type:application/json" https://demo.dataverse.org/api/dataverses/root/roles --upload-file roles.json - -Where ``roles.json`` looks like this:: - - { - "alias": "sys1", - "name": “Restricted System Role”, - "description": “A person who may only add datasets.”, - "permissions": [ - "AddDataset" - ] - } - -.. note:: Only a Dataverse installation account with superuser permissions is allowed to create roles in a Dataverse Collection. - - Show Role ~~~~~~~~~ From a841ce66ec390130fba45340fb6e8f8bd666e3fd Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Fri, 16 Jun 2023 11:52:16 +0200 Subject: [PATCH 2/8] Example for roles.json in chapter "Roles --- doc/sphinx-guides/source/api/native-api.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 70bca7e65a7..0844c3a38ea 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -3014,6 +3014,20 @@ Optionally, you may use a third query parameter "sendEmailNotification=false" to Roles ----- +JSON Representation of a Role +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The JSON representation of a role (``roles.json``) looks like this:: + + { + "alias": "sys1", + "name": “Restricted System Role”, + "description": “A person who may only add datasets.”, + "permissions": [ + "AddDataset" + ] + } + Show Role ~~~~~~~~~ From 6e2006aa68a2857df0eb7da0a4b7b1ef0c6b3f46 Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Fri, 16 Jun 2023 12:42:31 +0200 Subject: [PATCH 3/8] Link to the JSON representation of a role, add example --- doc/sphinx-guides/source/api/native-api.rst | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 0844c3a38ea..5255e3e5d14 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -315,16 +315,7 @@ The fully expanded example above (without environment variables) looks like this curl -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -X POST -H "Content-type:application/json" https://demo.dataverse.org/api/dataverses/root/roles --upload-file roles.json -Where ``roles.json`` looks like this:: - - { - "alias": "sys1", - "name": “Restricted System Role”, - "description": “A person who may only add datasets.”, - "permissions": [ - "AddDataset" - ] - } +``roles.json`` see :ref:`json-representation-of-a-role` .. note:: Only a Dataverse installation account with superuser permissions is allowed to create roles in a Dataverse Collection. @@ -3893,6 +3884,16 @@ Create Global Role Creates a global role in the Dataverse installation. The data POSTed are assumed to be a role JSON. :: POST http://$SERVER/api/admin/roles + +.. code-block:: bash + + export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + export SERVER_URL=https://demo.dataverse.org + export ID=root + + curl -H X-Dataverse-key:$API_TOKEN -X POST $SERVER_URL/api/admin/roles --upload-file roles.json + +``roles.json`` see :ref:`json-representation-of-a-role` Delete Global Role ~~~~~~~~~~~~~~~~~~ From 48f89bc357064068bf27a2cdf467f3a8595f0172 Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Fri, 16 Jun 2023 12:50:10 +0200 Subject: [PATCH 4/8] Add information about length contraint of role alias --- doc/sphinx-guides/source/api/native-api.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 5255e3e5d14..52bfc3e5ac2 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -3019,6 +3019,8 @@ The JSON representation of a role (``roles.json``) looks like this:: ] } +.. note:: alias is constrained to a length of 16 characters + Show Role ~~~~~~~~~ From ed862b74edc6697a9c606ee7efd664bd8b8e15a7 Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Fri, 16 Jun 2023 13:09:10 +0200 Subject: [PATCH 5/8] define label _json-representation-of-a-role --- doc/sphinx-guides/source/api/native-api.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 52bfc3e5ac2..44140656c68 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -3005,6 +3005,8 @@ Optionally, you may use a third query parameter "sendEmailNotification=false" to Roles ----- +.. _json-representation-of-a-role: + JSON Representation of a Role ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From bdd75085b4c73a8f163d5802a28b03d9c0fb1b2c Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Tue, 20 Jun 2023 09:49:04 +0200 Subject: [PATCH 6/8] Add chapter "Create Role" in section "Roles" --- doc/sphinx-guides/source/api/native-api.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 44140656c68..0a9e13b5a4e 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -3023,6 +3023,11 @@ The JSON representation of a role (``roles.json``) looks like this:: .. note:: alias is constrained to a length of 16 characters +Create Role +~~~~~~~~~ + +Roles can be created globally or for individual Dataverse Collections (see the corresponding sections in this document). + Show Role ~~~~~~~~~ From 1a39f239c96174278c2df479797def80b9cc112c Mon Sep 17 00:00:00 2001 From: Leonhard Maylein Date: Tue, 20 Jun 2023 09:52:15 +0200 Subject: [PATCH 7/8] Fix "title underline too short" --- doc/sphinx-guides/source/api/native-api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 0a9e13b5a4e..dbdf1a4fd60 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -3024,7 +3024,7 @@ The JSON representation of a role (``roles.json``) looks like this:: .. note:: alias is constrained to a length of 16 characters Create Role -~~~~~~~~~ +~~~~~~~~~~~ Roles can be created globally or for individual Dataverse Collections (see the corresponding sections in this document). From f1e7443787cbe8cd433a8384f3e164934bc75faf Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 24 Jul 2023 09:41:58 -0400 Subject: [PATCH 8/8] role docs: add cross links, minor tweaks #9646 --- doc/sphinx-guides/source/api/native-api.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index dbdf1a4fd60..ef2896e9777 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -296,6 +296,8 @@ The fully expanded example above (without environment variables) looks like this curl -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -X POST -H "Content-type:application/json" https://demo.dataverse.org/api/dataverses/root/metadatablockfacets/isRoot -d 'true' +.. _create-role-in-collection: + Create a New Role in a Dataverse Collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -315,7 +317,7 @@ The fully expanded example above (without environment variables) looks like this curl -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -X POST -H "Content-type:application/json" https://demo.dataverse.org/api/dataverses/root/roles --upload-file roles.json -``roles.json`` see :ref:`json-representation-of-a-role` +For ``roles.json`` see :ref:`json-representation-of-a-role` .. note:: Only a Dataverse installation account with superuser permissions is allowed to create roles in a Dataverse Collection. @@ -3005,6 +3007,8 @@ Optionally, you may use a third query parameter "sendEmailNotification=false" to Roles ----- +A role is a set of permissions. + .. _json-representation-of-a-role: JSON Representation of a Role @@ -3026,7 +3030,7 @@ The JSON representation of a role (``roles.json``) looks like this:: Create Role ~~~~~~~~~~~ -Roles can be created globally or for individual Dataverse Collections (see the corresponding sections in this document). +Roles can be created globally (:ref:`create-global-role`) or for individual Dataverse collections (:ref:`create-role-in-collection`). Show Role ~~~~~~~~~ @@ -3887,6 +3891,8 @@ List all global roles in the system. :: GET http://$SERVER/api/admin/roles +.. _create-global-role: + Create Global Role ~~~~~~~~~~~~~~~~~~