Skip to content

Added new functionality to decision tree on Moderators View

MariaV requested to merge decision_tree_moderator_view into master
  • Added new logic to views.py and moderators.html template to account for three possible configurations of moderator - moderator for issues/notes only, moderator for gitlab account requests, and moderator for both gitlab account requests and issues/notes.
  • Refactored out "is_moderator" function into two functions: is_moderator, is_account_approver, and added a check for super_user status to each. Created a new function, is_mod_or_approver, that returns True if the user is either a moderator or account approver--this way, any of the three functions can be used to decorate a view with user_passes_test or can be used in functions within the view with is_function(user) == True:
  • Decorated note_update and issue_update views with is_moderator (so that account approvers only would not be able to access update view.)
  • Decorated 'moderator' with is_mod_or_approver.
  • Added logic within the moderator_view functions that determines if the user is a mod and passes the formsets if so, if not, passes blank formset dictionaries and a messages dictionary specifying that the user does not have the requisite permissions.
  • Updated template to now show "No X pending" vs a message from messages if user does not have permission.
  • Tested post data, and data posted and views successfully.

Merge request reports