Skip to content

Commit fca2de3

Browse files
Samk13Sam Arbid
authored and
Sam Arbid
committed
settings: conditionally limit available review policies
* When RDM_COMMUNITY_REQUIRED_TO_PUBLISH is set to True we limit the options available for review policies to closed.
1 parent 1bdcc55 commit fca2de3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

invenio_communities/views/communities.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Invenio.
44
# Copyright (C) 2016-2024 CERN.
55
# Copyright (C) 2023 Graz University of Technology.
6+
# Copyright (C) 2024 KTH Royal Institute of Technology.
67
#
78
# Invenio is free software; you can redistribute it and/or modify it
89
# under the terms of the MIT License; see LICENSE file for more details.
@@ -432,14 +433,27 @@ def communities_settings_submission_policy(pid_value, community, community_ui):
432433
if not permissions["can_update"]:
433434
raise PermissionDeniedError()
434435

436+
if current_app.config.get("RDM_COMMUNITY_REQUIRED_TO_PUBLISH", False):
437+
# Restrict review policies when publishing with community is required
438+
available_review_policies = [
439+
{
440+
"text": "Review all submissions",
441+
"value": "closed",
442+
"icon": "lock",
443+
"helpText": _("All submissions to the community must be reviewed."),
444+
}
445+
]
446+
else:
447+
available_review_policies = REVIEW_POLICY_FIELDS
448+
435449
return render_community_theme_template(
436450
"invenio_communities/details/settings/submission_policy.html",
437451
theme=community_ui.get("theme", {}),
438452
community=community_ui,
439453
permissions=permissions,
440454
form_config=dict(
441455
access=dict(
442-
review_policy=REVIEW_POLICY_FIELDS,
456+
review_policy=available_review_policies,
443457
record_submission_policy=RECORDS_SUBMISSION_POLICY_FIELDS,
444458
),
445459
),

0 commit comments

Comments
 (0)