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

access: allow dump of parent.access.settings field #1375

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
3 changes: 0 additions & 3 deletions invenio_rdm_records/services/schemas/parent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ class RDMParentSchema(ParentSchema, FieldPermissionsMixin):
"""Record schema."""

field_dump_permissions = {
# omit the 'access' field from dumps, except for users with
# 'manage' permissions
"access": "manage",
# omit 'review' from dumps except for users with curate permission
"review": "review",
}
Expand Down
11 changes: 10 additions & 1 deletion invenio_rdm_records/services/schemas/parent/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from marshmallow import Schema, fields, validate
from marshmallow_utils.fields import ISODateString, SanitizedUnicode, TZDateTime
from marshmallow_utils.permissions import FieldPermissionsMixin


class GrantSubject(Schema):
Expand Down Expand Up @@ -68,9 +69,17 @@ class AccessSettingsSchema(Schema):
accept_conditions_text = fields.String()


class ParentAccessSchema(Schema):
class ParentAccessSchema(Schema, FieldPermissionsMixin):
"""Access schema."""

field_dump_permissions = {
# omit fields from dumps except for users with 'manage' permissions
# allow only 'settings'
"grants": "manage",
"owned_by": "manage",
"links": "manage",
}

grants = fields.List(fields.Nested(Grant))
owned_by = fields.Nested(Agent)
links = fields.List(fields.Nested(SecretLink))
Expand Down
Loading