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

fix: support responses that assign multiple permission codes to the same group (DEV-3482) #75

Merged
merged 7 commits into from
Apr 16, 2024

Conversation

jnussbaum
Copy link
Collaborator

This PR introduces support for this response:

https://api.stage.dasch.swiss/admin/permissions/doap/http%3A%2F%2Frdfh.ch%2Fprojects%2F082D

"hasPermissions": [
    {
        "additionalInformation": "http://www.knora.org/ontology/knora-admin#ProjectAdmin",
        "name": "CR",
        "permissionCode": 8
    },
    {
        "additionalInformation": "http://www.knora.org/ontology/knora-admin#ProjectAdmin",
        "name": "RV",
        "permissionCode": 1
    },
    {
        "additionalInformation": "http://www.knora.org/ontology/knora-admin#ProjectAdmin",
        "name": "M",
        "permissionCode": 6
    },
    {
        "additionalInformation": "http://www.knora.org/ontology/knora-admin#ProjectAdmin",
        "name": "V",
        "permissionCode": 2
    },
    {
        "additionalInformation": "http://www.knora.org/ontology/knora-admin#ProjectAdmin",
        "name": "D",
        "permissionCode": 7
    }
]

Previously, this made the constructor of PermissionScope crash, because the validation says that the same group can only belong to one permission code. In the above example: ProjectAdmin belongs to CR only, because all other permission codes are already covered by CR.

@jnussbaum jnussbaum self-assigned this Mar 16, 2024
Copy link
Collaborator

@BalduinLandolt BalduinLandolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works, it works. But see my question/suggestion regarding simplifying the deduplication logic.

dsp_permissions_scripts/utils/scope_serialization.py Outdated Show resolved Hide resolved
@jnussbaum jnussbaum changed the title fix: support admin route responses that assign multiple permission codes to the same group fix: support admin route responses that assign multiple permission codes to the same group (DEV-3482) Apr 12, 2024
Copy link

linear bot commented Apr 12, 2024

DEV-3482 permissions scripts: handle admin route responses that assign multiple permission codes to the same group

--> check with backend if this behaviour of DSP-API is intended or a bug

@jnussbaum jnussbaum changed the title fix: support admin route responses that assign multiple permission codes to the same group (DEV-3482) fix: support responses that assign multiple permission codes to the same group (DEV-3482) Apr 16, 2024
@jnussbaum jnussbaum merged commit c109bf0 into main Apr 16, 2024
1 check passed
@jnussbaum jnussbaum deleted the wip/handle-duplicates branch April 16, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants