Skip to content

Commit 7f4685c

Browse files
committed
fix(projects): Allows automatic access for user covered by an institutional signer that has access
1 parent 9538168 commit 7f4685c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/projects/views.py

+15
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,21 @@ def is_user_granted_access(self, context):
931931
considered having been granted access to participate in this DataProject.
932932
Returns a boolean.
933933
"""
934+
# Check for institutional access
935+
try:
936+
member = InstitutionalMember.objects.get(official__project=self.project, email=self.request.user.email)
937+
logger.debug(f"Institutional member found under official: {member.official.user.email}")
938+
939+
# Check if official has access
940+
official_participant = Participant.objects.get(project=self.project, user=member.official.user)
941+
if official_participant.permission == "VIEW":
942+
logger.debug(f"Institutional official has access, granting access to member")
943+
return True
944+
else:
945+
logger.debug(f"Institutional official does not have access")
946+
947+
except ObjectDoesNotExist:
948+
logger.debug(f"No institutional member found")
934949

935950
# Does user not have VIEW permissions?
936951
if not context['has_view_permission']:

0 commit comments

Comments
 (0)