Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow external iris for property and resource class when updating doap (DEV-4341) #3425

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3704c0c
fix: Allow external iris for property and resource class when updatin…
seakayone Nov 14, 2024
c6957c0
Merge branch 'main' into fix/allow-external-iri-for-doap-update-DEV-4286
seakayone Nov 14, 2024
92c2e5f
cleanup ChangePermissionResourceClassApiRequestADM
seakayone Nov 14, 2024
e328f61
replace property and resource class and add endpoint PUT /admin/doap/…
seakayone Nov 14, 2024
6058e1f
simplify and align api for changing a doap
seakayone Nov 14, 2024
6fc4e77
Allow updates to the permissions of a doap
seakayone Nov 14, 2024
3aff3da
fixup
seakayone Nov 14, 2024
fc1493c
rename responder method
seakayone Nov 14, 2024
64028d5
update documentation
seakayone Nov 14, 2024
70b9130
update docs
seakayone Nov 14, 2024
a08fb52
fix doc
seakayone Nov 14, 2024
aed4cb2
fix docs
seakayone Nov 14, 2024
26968f4
fix docs
seakayone Nov 14, 2024
3a469de
fix docs
seakayone Nov 14, 2024
3fd1ff6
reuse updateDoap method
seakayone Nov 14, 2024
b3afdfa
when transforming a PermissionADM into a DefaultObjectAccessPermissio…
seakayone Nov 14, 2024
e21e7ac
fixup
seakayone Nov 14, 2024
1b75d10
use internal method and reduce duplicate code
seakayone Nov 15, 2024
f430dfe
Merge branch 'main' into fix/allow-external-iri-for-doap-update-DEV-4286
seakayone Nov 15, 2024
d80d844
Update docs/03-endpoints/api-admin/permissions.md
seakayone Nov 15, 2024
6228ba4
Update docs/03-endpoints/api-admin/permissions.md
seakayone Nov 15, 2024
a9505cd
Update docs/03-endpoints/api-admin/permissions.md
seakayone Nov 15, 2024
bfea1b8
Update docs/03-endpoints/api-admin/permissions.md
seakayone Nov 15, 2024
4b4ca86
Update docs/03-endpoints/api-admin/permissions.md
seakayone Nov 15, 2024
a7da0ff
Update docs/03-endpoints/api-admin/permissions.md
seakayone Nov 15, 2024
bd242aa
replace properties with attributes
seakayone Nov 15, 2024
5f141b6
Merge branch 'main' into fix/allow-external-iri-for-doap-update-DEV-4286
seakayone Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 48 additions & 33 deletions docs/03-endpoints/api-admin/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
For an extensive explanation on how DSP permissions are implemented, see
[here](../../05-internals/design/api-admin/administration.md#permissions).

| Route | Operations | Explanation |
| ------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/admin/permissions/{projectIri}` | `GET` | [get all permissions of a project](#getting-permissions) |
| `/admin/permissions/ap/{projectIri}` | `GET` | [get all administrative permissions of a project](#getting-permissions) |
| `/admin/permissions/ap/{projectIri}/{groupIri}` | `GET` | [get all administrative permissions of a group](#getting-permissions) |
| `/admin/permissions/doap/{projectIri}` | `GET` | [get all default object access permissions of a project](#getting-permissions) |
| `/admin/permissions/ap` | `POST` | [create a new administrative permission](#creating-new-administrative-permissions) |
| `/admin/permissions/doap` | `POST` | [create a new default object access permission](#creating-new-default-object-access-permissions) |
| `/admin/permissions/{permissionIri}/group` | `PUT` | [update for which group an administrative or default object access permission is used](#updating-a-permissions-group) |
| `/admin/permissions/{permissionIri}/hasPermission` | `PUT` | [update the scope of an administrative or default object access permission](#updating-a-permissions-scope), i.e. what permissions are granted to which group when this permission applies |
| `/admin/permissions/{doap_permissionIri}/resourceClass` | `PUT` | [update for which resource class a default object access permission applies](#updating-a-default-object-access-permissions-resource-class) |
| `/admin/permissions/{doap_permissionIri}/property` | `PUT` | [update for which property a default object access permission applies](#updating-a-default-object-access-permissions-property) |
| `/admin/permissions/{permissionIri}` | `DELETE` | [delete an administrative or default object access permission](#deleting-a-permission) |
| Route | Operations | Explanation |
|-------------------------------------------------------------|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `/admin/permissions/{projectIri}` | `GET` | [get all permissions of a project](#getting-permissions) |
| `/admin/permissions/ap/{projectIri}` | `GET` | [get all administrative permissions of a project](#getting-permissions) |
| `/admin/permissions/ap/{projectIri}/{groupIri}` | `GET` | [get all administrative permissions of a group](#getting-permissions) |
| `/admin/permissions/doap/{projectIri}` | `GET` | [get all default object access permissions of a project](#getting-permissions) |
| `/admin/permissions/ap` | `POST` | [create a new administrative permission](#creating-new-administrative-permissions) |
| `/admin/permissions/doap` | `POST` | [create a new default object access permission](#creating-new-default-object-access-permissions) |
| `/admin/permissions/doap/{permissionIri}` | `PUT` | [update an existing default object access permission](#updating-an-existing-default-object-access-permission) |
| `/admin/permissions/{permissionIri}/group` | `PUT` | [update for which group an administrative or default object access permission is used](#updating-a-permissions-group) |
| `/admin/permissions/{permissionIri}/hasPermission` | `PUT` | [update the scope of an administrative or default object access permission](#updating-a-permissions-scope), i.e. what permissions are granted to which group when this permission applies |
| `/admin/permissions/{permissionIri}` | `DELETE` | [delete an administrative or default object access permission](#deleting-a-permission) |
| ~~`/admin/permissions/{doap_permissionIri}/resourceClass`~~ | `PUT` | **deprecated**, use `/admin/permissions/doap/{permissionIri}` instead) |
| ~~`/admin/permissions/{doap_permissionIri}/property`~~ | `PUT` | **deprecated**, use `/admin/permissions/doap/{permissionIri}` instead) |
seakayone marked this conversation as resolved.
Show resolved Hide resolved

## Permission Operations

Expand Down Expand Up @@ -224,6 +225,9 @@ However, the default permissions set for these groups can be modified; see below

### Updating a Permission's Group

[NOTE!] For Default Object Access Permissions this endpoint is deprecated,
use [`PUT: /admin/permissions/doap/<permissionIri>`](#updating-an-existing-default-object-access-permission) instead.

- `PUT: /admin/permissions/<permissionIri>/group` to change the group for which an administrative or a default object
access permission, identified by its IRI `<permissionIri>`, is defined. The request body must contain the IRI of the new
group as below:
Expand All @@ -242,6 +246,9 @@ the combination of both, the permission will be defined for the newly specified

### Updating a Permission's Scope

[NOTE!] For Default Object Access Permissions this endpoint is deprecated,
use [`PUT: /admin/permissions/doap/<permissionIri>`](#updating-an-existing-default-object-access-permission) instead.

- `PUT: /admin/permissions/<permissionIri>/hasPermissions` to change the scope of permissions assigned to an administrative
or a default object access permission identified by it IRI, `<permissionIri>`. The request body must contain the new set
of permission types as below:
Expand All @@ -268,37 +275,45 @@ Either the `name` or the `permissionCode` must be present; it is not necessary t
The previous permission set is *replaced* by the new permission set. In order to remove a permission for a group
entirely, you can provide a new set of permissions, leaving out the permission specification for the group.

### Updating a Default Object Access Permission's Resource Class

- `PUT: /admin/permissions/<doap_permissionIri>/resourceClass` to change the resource class for which a default object
access permission, identified by it IRI `<doap_permissionIri>`, is defined. This operation is only valid for
updating a default object acceess permission. The IRI of the new resource class must be given in the request body as:
### Updating an existing Default Object Access Permission

- `PUT: /admin/permissions/doap/<doap_permissionIri>` to change the properties of an existing default object
seakayone marked this conversation as resolved.
Show resolved Hide resolved
access permission, identified by it IRI `<doap_permissionIri>`.
seakayone marked this conversation as resolved.
Show resolved Hide resolved
seakayone marked this conversation as resolved.
Show resolved Hide resolved
The IRI of the new property must be given in the request body as:

```json
{
"forResourceClass": "http://api.dasch.swiss/ontology/0803/incunabula/v2#bild"
"forProperty" : "http://api.dasch.swiss/ontology/00FF/images/v2#titel",
"forResourceClass": "http://api.dasch.swiss/ontology/0803/incunabula/v2#bild",
seakayone marked this conversation as resolved.
Show resolved Hide resolved
"forGroup": null,
"hasPermissions":[
{
"additionalInformation":"http://www.knora.org/ontology/knora-admin#ProjectMember",
"name":"D",
"permissionCode":7
seakayone marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
```

Note that if the default object access permission was originally defined for a group, with this operation, the permission
will be defined for the given resource class instead of the group. That means the value of the `forGroup` will
be deleted.
All properties of the default object access permission are optional and may be combined.

### Updating a Default Object Access Permission's Property
[NOTE!] Only certain combinations of properties are allowed. The following combinations are allowed:
seakayone marked this conversation as resolved.
Show resolved Hide resolved
seakayone marked this conversation as resolved.
Show resolved Hide resolved

- `PUT: /admin/permissions/<doap_permissionIri>/property` to change the property for which a default object
access permission, identified by it IRI `<doap_permissionIri>`, is defined. This operation is only valid for
updating a default object access permission. The IRI of the new property must be given in the request body as:
- `forGroup`
- `forResourceClass`
- `forProperty`
- `forResourceClass` and `forProperty`

```json
{
"forProperty" :"http://api.dasch.swiss/ontology/00FF/images/v2#titel"
}
```
If the combination of properties is not allowed, the request will fail with a `400 Bad Request` error.
Any valid combination of properties will replace the existing values.

If present, the `hasPermissions` property must contain the necessary parameters with respect to the type of the permission
as described in the [Creating New Default Object Access Permissions](#creating-new-default-object-access-permissions) section.

Note that if the default object access permission was originally defined for a group, with this operation, the permission
will be defined for the given property instead of the group. That means the value of the `forGroup` will
be deleted.
The response is the updated default object access permission with its new properties and is the same as when
[creating a new default object access permission](#creating-new-default-object-access-permissions).

### Deleting a Permission

Expand Down
Loading
Loading