Remove redundant author validation check in collection_take_start and streamline access control in ExamOrCollectionGenericBase
This commit is contained in:
@@ -2125,10 +2125,6 @@ def collection_take_start(request, pk, cid=None, passcode=None):
|
|||||||
valid_user = False
|
valid_user = False
|
||||||
#valid_user = collection.check_logged_in_user(request)
|
#valid_user = collection.check_logged_in_user(request)
|
||||||
|
|
||||||
if not valid_user and collection.is_author(request.user):
|
|
||||||
valid_user = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cid_exam = None
|
cid_exam = None
|
||||||
if collection.collection_type == "REV" or valid_user:
|
if collection.collection_type == "REV" or valid_user:
|
||||||
|
|||||||
@@ -768,6 +768,9 @@ class ExamOrCollectionGenericBase(models.Model, AuthorMixin):
|
|||||||
Raises:
|
Raises:
|
||||||
Http404: If user does not have access
|
Http404: If user does not have access
|
||||||
"""
|
"""
|
||||||
|
if user is not None and self.is_author(user):
|
||||||
|
return
|
||||||
|
|
||||||
# If we are limiting by dates check that the current date is within the range
|
# If we are limiting by dates check that the current date is within the range
|
||||||
if self.restrict_to_dates:
|
if self.restrict_to_dates:
|
||||||
if self.start_date >= timezone.now() or (
|
if self.start_date >= timezone.now() or (
|
||||||
|
|||||||
Reference in New Issue
Block a user