diff --git a/course/flow.py b/course/flow.py index b7f20c1aec5739627e23c512ec72e829ac113de7..48d4694183beb10ec323af2cc771441f25bcc3e0 100644 --- a/course/flow.py +++ b/course/flow.py @@ -941,6 +941,11 @@ def post_start_flow(pctx, fctx, flow_id): access_rules_tag=session_start_rule.tag_session, now_datetime=now_datetime) + if session_start_rule.lock_down_as_exam_session: + pctx.request.session[ + "relate_session_locked_to_exam_flow_session_pk"] = \ + session.pk + return redirect("relate-view_flow_page", pctx.course.identifier, session.id, 0) diff --git a/course/utils.py b/course/utils.py index 76bd498e7f8056f6acb742289747a83ac808648c..9eb45e03a8aee354aece411f2eb9030af59bba8b 100644 --- a/course/utils.py +++ b/course/utils.py @@ -61,6 +61,7 @@ class FlowSessionStartRule(FlowSessionRuleBase): "tag_session", "may_start_new_session", "may_list_existing_sessions", + "lock_down_as_exam_session", ] @@ -204,6 +205,8 @@ def get_session_start_rule(course, participation, role, flow_id, flow_desc, rule, "may_start_new_session", True), may_list_existing_sessions=getattr( rule, "may_list_existing_sessions", True), + lock_down_as_exam_session=getattr( + rule, "lock_down_as_exam_session", False), ) return FlowSessionStartRule( diff --git a/course/validation.py b/course/validation.py index 4076f6a4a15066f7eae05f60757900177acd926c..6c2685b1f43b9bde21605f9363036055970cf611 100644 --- a/course/validation.py +++ b/course/validation.py @@ -470,6 +470,7 @@ def validate_session_start_rule(ctx, location, nrule, tags): ("tag_session", (six.string_types, type(None))), ("may_start_new_session", bool), ("may_list_existing_sessions", bool), + ("lock_down_as_exam_session", bool), ] ) diff --git a/doc/flow.rst b/doc/flow.rst index 07d0778c9a68c152f5a519f98d43d179b8c3cf8b..670774c40569ef97974b9c0a72d6a1cd5825c116 100644 --- a/doc/flow.rst +++ b/doc/flow.rst @@ -340,6 +340,11 @@ Rules for starting new sessions (Mandatory) A Boolean (True/False) value indicating whether, if the rule applies, the participant may view a list of existing sessions. + .. attribute:: lock_down_as_exam_session + + (Optional) Once this flow has been started, access to all content + except for this session on this RELATE instance will be denied. + .. attribute:: tag_session (Optional) An identifier that will be applied to a newly-created session as a "tag".