From d50a4d297d139620a6add82cf3d6a40358cb7567 Mon Sep 17 00:00:00 2001 From: David <9059044+Tansito@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:27:21 -0500 Subject: [PATCH] rename groups repository into user repository --- gateway/api/repositories/functions.py | 12 ++++++------ gateway/api/repositories/{groups.py => users.py} | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) rename gateway/api/repositories/{groups.py => users.py} (93%) diff --git a/gateway/api/repositories/functions.py b/gateway/api/repositories/functions.py index 517b9c5ca..3aa17f03f 100644 --- a/gateway/api/repositories/functions.py +++ b/gateway/api/repositories/functions.py @@ -12,7 +12,7 @@ VIEW_PROGRAM_PERMISSION, Program as Function, ) -from api.repositories.groups import GroupRepository +from api.repositories.users import UserRepository logger = logging.getLogger("gateway") @@ -26,7 +26,7 @@ class FunctionRepository: # This repository should be in the use case implementatio # but this class is not ready yet so it will live here # in the meantime - group_repository = GroupRepository() + user_repository = UserRepository() def get_functions_with_view_permissions(self, author) -> List[Function]: """ @@ -41,7 +41,7 @@ def get_functions_with_view_permissions(self, author) -> List[Function]: List[Function]: all the functions available to the user """ - view_groups = self.group_repository.get_groups_by_permissions( + view_groups = self.user_repository.get_groups_by_permissions( user=author, permission_name=VIEW_PROGRAM_PERMISSION ) author_groups_with_view_permissions_criteria = Q(instances__in=view_groups) @@ -94,7 +94,7 @@ def get_provider_functions_with_run_permissions(self, author) -> List[Function]: List[Program]: providers functions available to the user """ - run_groups = self.group_repository.get_groups_by_permissions( + run_groups = self.user_repository.get_groups_by_permissions( user=author, permission_name=RUN_PROGRAM_PERMISSION ) author_groups_with_run_permissions_criteria = Q(instances__in=run_groups) @@ -159,7 +159,7 @@ def get_provider_function_by_title_with_view_permissions( # This access should be checked in the use-case but how we don't # have it implemented yet we will do the check by now in the # repository call - view_groups = self.group_repository.get_groups_by_permissions( + view_groups = self.user_repository.get_groups_by_permissions( user=author, permission_name=VIEW_PROGRAM_PERMISSION ) author_groups_with_view_permissions_criteria = Q(instances__in=view_groups) @@ -203,7 +203,7 @@ def get_provider_function_by_title_with_run_permissions( # This access should be checked in the use-case but how we don't # have it implemented yet we will do the check by now in the # repository call - run_groups = self.group_repository.get_groups_by_permissions( + run_groups = self.user_repository.get_groups_by_permissions( user=author, permission_name=RUN_PROGRAM_PERMISSION ) author_groups_with_run_permissions_criteria = Q(instances__in=run_groups) diff --git a/gateway/api/repositories/groups.py b/gateway/api/repositories/users.py similarity index 93% rename from gateway/api/repositories/groups.py rename to gateway/api/repositories/users.py index c6b7ab144..a6b3952a4 100644 --- a/gateway/api/repositories/groups.py +++ b/gateway/api/repositories/users.py @@ -7,7 +7,7 @@ from django.db.models import Q -class GroupRepository: # pylint: disable=too-few-public-methods +class UserRepository: # pylint: disable=too-few-public-methods """ The main objective of this class is to manage the access to the model """