Skip to content

Commit

Permalink
rename groups repository into user repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Tansito committed Dec 20, 2024
1 parent 99a0fd5 commit d50a4d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions gateway/api/repositories/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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]:
"""
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down

0 comments on commit d50a4d2

Please sign in to comment.