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

Introduce conditional DisableIf generator & read-only mode #86

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

max-moser
Copy link
Contributor

@max-moser max-moser commented Oct 28, 2022

This can be used to implement a conditional read-only mode, e.g. enabled temporarily to make system migrations smoother.

To do:

  • add some tests for the new generators and configuration items

tests/test_generators.py Outdated Show resolved Hide resolved
tests/test_generators.py Outdated Show resolved Hide resolved
invenio_records_permissions/generators.py Outdated Show resolved Hide resolved
invenio_records_permissions/generators.py Outdated Show resolved Hide resolved
invenio_records_permissions/generators.py Outdated Show resolved Hide resolved
invenio_records_permissions/config.py Show resolved Hide resolved
@fenekku
Copy link
Contributor

fenekku commented Mar 10, 2023

Coordination:

This one has been sitting for 3weeks+

Surfacing this back to attention for @utnapischtim , @ppanero and @ntarocco . If someone else would be better suited to look at it, let us know!

Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

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

LGTM! It would be even better to add a test for a service:

RECORDS_PERMISSIONS_READ_ONLY = True

with PermissionDenied:
    service.update(record, "owner", data)

@chokribr
Copy link
Member

@utnapischtim @ppanero please take a look!

* it seems like it was missing before
* this can be used to implement a conditional read-only mode, e.g.
  enabled temporarily to make system migrations smoother
@max-moser max-moser force-pushed the mm/conditional-disable-generator branch from 3f9cc1a to a6c3afa Compare March 20, 2024 15:23
@max-moser
Copy link
Contributor Author

Given that Mr. E already provided the ConditionalGenerator, I reworked this PR to be based off that instead.
Over the course of that, the functionality of having the config option a callable got thrown out the window.

Given that we override most of the permission policies in our own modules anyway, we can add that feature in locally for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Work in progress
Development

Successfully merging this pull request may close these issues.

5 participants