Skip to content

Commit

Permalink
settings: conditionally limit available review policies
Browse files Browse the repository at this point in the history
* When RDM_COMMUNITY_REQUIRED_TO_PUBLISH is set to True we limit the options available for review policies to closed.
  • Loading branch information
Samk13 authored and Sam Arbid committed Oct 19, 2024
1 parent 1bdcc55 commit fca2de3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion invenio_communities/views/communities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is part of Invenio.
# Copyright (C) 2016-2024 CERN.
# Copyright (C) 2023 Graz University of Technology.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -432,14 +433,27 @@ def communities_settings_submission_policy(pid_value, community, community_ui):
if not permissions["can_update"]:
raise PermissionDeniedError()

if current_app.config.get("RDM_COMMUNITY_REQUIRED_TO_PUBLISH", False):
# Restrict review policies when publishing with community is required
available_review_policies = [
{
"text": "Review all submissions",
"value": "closed",
"icon": "lock",
"helpText": _("All submissions to the community must be reviewed."),
}
]
else:
available_review_policies = REVIEW_POLICY_FIELDS

return render_community_theme_template(
"invenio_communities/details/settings/submission_policy.html",
theme=community_ui.get("theme", {}),
community=community_ui,
permissions=permissions,
form_config=dict(
access=dict(
review_policy=REVIEW_POLICY_FIELDS,
review_policy=available_review_policies,
record_submission_policy=RECORDS_SUBMISSION_POLICY_FIELDS,
),
),
Expand Down

0 comments on commit fca2de3

Please sign in to comment.