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

deposit-ui: permissions-based record access config #2142

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

slint
Copy link
Member

@slint slint commented Mar 10, 2023

Depends on inveniosoftware/react-invenio-deposit#622 and inveniosoftware/invenio-rdm-records#1223.

❤️ Thank you for your contribution!

Description

Please describe briefly your pull request.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Third-party code

If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

* Passes config to the upload form based on permissions, to control
  the display of record access and metadata-only toggles.
@@ -78,6 +78,15 @@ def get_form_pids_config():
return pids_providers


def get_record_permissions(actions, record=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to make it a part of the service class?

Copy link
Member Author

Choose a reason for hiding this comment

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

It feels a lot like a utility function, since service methods usually return ResultItem objects. Another issue is that the record argument has to be an API Record which is difficult to get hold of without calling a service and accessing item._record...

There's a similar method on ResultItem.has_permissions_to, used on the deposit_edit view below, which does exactly that. The issue is that in the deposit_create view, we don't have a draft item result from the service to call it (since we're starting a new one).

It would look something like inveniosoftware/invenio-records-resources#456, but kwargs would need to be low-level objects.

@kpsherva kpsherva merged commit 4f28646 into inveniosoftware:master Mar 21, 2023
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.

deposit: disallow fully restricted records
4 participants