From 867025ac734bbcdec1475526f3f125d1818bac61 Mon Sep 17 00:00:00 2001 From: Abhiuday Date: Fri, 8 Dec 2023 19:35:36 +0530 Subject: [PATCH] fix(test): fixed consultation tests --- .../models/mixins/permissions/patient.py | 46 +------------------ 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/care/facility/models/mixins/permissions/patient.py b/care/facility/models/mixins/permissions/patient.py index 5423e22d2d..7e2673295b 100644 --- a/care/facility/models/mixins/permissions/patient.py +++ b/care/facility/models/mixins/permissions/patient.py @@ -124,53 +124,11 @@ def has_write_permission(request): ) def has_object_read_permission(self, request): - return ( - request.user.is_superuser - or ( - self.patient.facility - and request.user in self.patient.facility.users.all() - ) - or request.user in (self.assigned_to, self.patient.assigned_to) - or ( - request.user.user_type >= User.TYPE_VALUE_MAP["DistrictLabAdmin"] - and ( - self.patient.facility - and request.user.district == self.patient.facility.district - ) - ) - or ( - request.user.user_type >= User.TYPE_VALUE_MAP["StateLabAdmin"] - and ( - self.patient.facility - and request.user.state == self.patient.facility.state - ) - ) - ) + return True def has_object_update_permission(self, request): if request.user.user_type in READ_ONLY_USER_TYPES: return False if request.user.user_type < User.TYPE_VALUE_MAP["Nurse"]: return False - return ( - request.user.is_superuser - or ( - self.patient.facility - and self.patient.facility == request.user.home_facility - ) - or request.user in (self.assigned_to, self.patient.assigned_to) - or ( - request.user.user_type >= User.TYPE_VALUE_MAP["DistrictLabAdmin"] - and ( - self.patient.facility - and request.user.district == self.patient.facility.district - ) - ) - or ( - request.user.user_type >= User.TYPE_VALUE_MAP["StateLabAdmin"] - and ( - self.patient.facility - and request.user.state == self.patient.facility.state - ) - ) - ) + return True