diff --git a/alyx/alyx/base.py b/alyx/alyx/base.py index bd971157..ed1ce5f8 100644 --- a/alyx/alyx/base.py +++ b/alyx/alyx/base.py @@ -378,6 +378,15 @@ def has_change_permission(self, request, obj=None): return True if request.user.is_superuser: return True + + # [CR 2024-03-12] + # HACK: following a request by Charu R from cortexlab, we authorize all users in the + # special Husbandry group to edit litters. + husbandry = 'husbandry' in ', '.join(_.name.lower() for _ in request.user.groups.all()) + if husbandry: + if obj.__class__.__name__ in ('Litter', 'Subject', 'BreedingPair'): + return True + # Find subject associated to the object. if hasattr(obj, 'responsible_user'): subj = obj @@ -640,6 +649,7 @@ class BaseRestPublicPermission(permissions.BasePermission): """ The purpose is to prevent public users from interfering in any way using writable methods """ + def has_permission(self, request, view): if request.method == 'GET': return True