troeger / opensubmit

Just another submission system for course assignment solutions. Supports semi-automated code evaluation.
GNU Affero General Public License v3.0
30 stars 18 forks source link

AnonymousUser accessing /assignments/1/new/ raises exception #245

Open johenning opened 6 years ago

johenning commented 6 years ago

In the class SubmissionNewView (web/opensubmit/views/frontend.py the LoginRequiredMixin redirection mechanism is overwritten by the dispatch function, which calls can_create_submissionand produces an Exception, because an authorized user is expected. (Exception: 'AnonymousUser' object has no attribute 'profile')

The simple fix is to check user.is_authenticated() in the dispatch function. The right way to fix this would probably be writing a custom Mixin for checking submission priviledges.

troeger commented 5 years ago

Keeping this issue open, in order to get a better solution that keeps the LoginRequiredMixin intact.