learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
82 stars 57 forks source link

Fix profile editor redirect for teachers #3729

Closed willgearty closed 3 months ago

willgearty commented 3 months ago

3651 removed the "Teachers/Class" permission choice, but it looks like there is still one place where we used this permission:

https://github.com/learning-unlimited/ESP-Website/blob/41a75789a892563ee7600c64b0481637d45a346f/esp/esp/web/views/main.py#L239-L262

Looks like we'll need to pick another (somewhat arbitrary) permission to use to see if registration is "open" for teachers.

willgearty commented 3 months ago

Thoughts: what if we change program_by_perm to have an any argument, and we could then specify one of the "implied" permissions (e.g., "Teachers/Classes/Create" in this case). Another idea is to let name be a list of permissions and we use __in.

willgearty commented 3 months ago

Looks like we actually already do the latter idea in this function: https://github.com/learning-unlimited/ESP-Website/blob/41a75789a892563ee7600c64b0481637d45a346f/esp/esp/users/models/__init__.py#L2512-L2526