harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
35 stars 30 forks source link

Allow membership in group Research Assistant to upload media #2021

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

fixes #2016

Simple change to the template to allow membership in the Django group "Research Assistant" to also upload media.

The group must exist in the environment with the hardcoded name. This has already been added to prod. If it doesn't exist this isn't an error; the check just won't pass.

As written this expects that a user will only belong to one Group. For this use case it will be fine as it would not make sense for RA users to also belong to other groups.

(Note that the existing check is already easy to bypass by a determined user.)

With group membership

image

Without group membership (no "Upload" link)

Screen Shot 2023-05-10 at 10 22 34 AM
codecov-commenter commented 1 year ago

Codecov Report

Merging #2021 (09d82ad) into develop (887fd49) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #2021      +/-   ##
===========================================
+ Coverage    76.65%   76.68%   +0.02%     
===========================================
  Files           64       64              
  Lines         7026     7034       +8     
===========================================
+ Hits          5386     5394       +8     
  Misses        1640     1640              
Impacted Files Coverage Δ
web/main/views.py 72.07% <100.00%> (+0.19%) :arrow_up: