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

documents: removes permssions from the search list #972

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ invenio-theme = ">=2.5.7,<3.0.0"

# Invenio auth bundle
invenio-access = ">=2.0.0,<3.0.0"
invenio-accounts = ">=3.0.0,<4.0.0"
invenio-accounts = ">=3.5.2,<4.0.0"
invenio-oauth2server = ">=2.0.0,<3.0.0"
invenio-oauthclient = ">=3.0.0,<4.0.0"
invenio-userprofiles = "^2.3.1"
Expand Down
2 changes: 1 addition & 1 deletion sonar/modules/documents/marshmallow/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class DocumentListMetadataSchemaV1(StrictKeysMixin):
customField3 = fields.List(fields.String(validate=validate.Length(min=1)))
masked = SanitizedUnicode()
_bucket = SanitizedUnicode()
_files = Nested(FileSchemaV1, many=True)
_files = Nested(ThumbnailSchemaV1, many=True)
_oai = fields.Dict()
# When loading, if $schema is not provided, it's retrieved by
# Record.schema property.
Expand Down
15 changes: 15 additions & 0 deletions tests/api/documents/test_documents_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
from invenio_accounts.testutils import login_user_via_session


def test_get(client, document_with_file):
"""Get REST methods."""
res = client.get(url_for('invenio_records_rest.doc_list', view='global'))
assert res.status_code == 200
assert res.json['hits']['total']['value'] == 1
# the search results does not contains permissions
assert not res.json['hits']['hits'][0]['metadata']['_files'][0].get("permissions")

# the item result should contains permissions
res = client.get(url_for('invenio_records_rest.doc_item', pid_value=document_with_file['pid']))
assert res.status_code == 200
assert res.json['metadata']['_files'][0]['permissions'] == {
'delete': False, 'read': False,'update': False}


def test_put(app, client, document_with_file):
"""Test putting metadata on existing file."""
# Disable configuration
Expand Down
Loading