Skip to content

Commit

Permalink
Added enrollment question check to CourseModulePermissionBase
Browse files Browse the repository at this point in the history
Before, the permission check would work by simply checking whether the module had opened yet. With this check, the module opening time is only checked if the exercise is not an enrollment question

Fixes #679
  • Loading branch information
EerikSaksi committed Sep 14, 2022
1 parent f0ef3db commit ea2a751
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion course/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ def has_object_permission(self, request: HttpRequest, view: Any, module: CourseM
if module.status == CourseModule.STATUS.HIDDEN:
return False

if not module.is_after_open():
#if this isn't an enrollment question and the module hasn't opened yet
if not (hasattr(view, 'exercise') and view.exercise.status in ('enrollment', 'enrollment_ext')) and not module.is_after_open():
# FIXME: use format from django settings
self.error_msg(
_('MODULE_PERMISSION_ERROR_NOT_OPEN_YET -- {date}'),
Expand Down

0 comments on commit ea2a751

Please sign in to comment.