Skip to content

Commit

Permalink
updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tansito committed Dec 20, 2024
1 parent 82aef0d commit da9bf35
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
25 changes: 17 additions & 8 deletions gateway/api/repositories/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ def get_functions_by_permission(
) -> List[Function]:
"""
Returns all the functions available to the user. This means:
- User functions where the user is the author
- Provider functions with view permissions
- User functions where the user is the author
- Provider functions with the permission specified
Args:
author: Django author from who retrieve the functions
permission_name (str): name of the permission. Values accepted
RUN_PROGRAM_PERMISSION, VIEW_PROGRAM_PERMISSION
Returns:
List[Function]: all the functions available to the user
Expand Down Expand Up @@ -86,10 +88,13 @@ def get_provider_functions_by_permission(
"""
Returns the provider functions available to the user. This means:
- Provider functions where the user has run permissions
- Provider functions where the user is the author
- Provider is NOT None
Args:
author: Django author from who retrieve the functions
permission_name (str): name of the permission. Values accepted
RUN_PROGRAM_PERMISSION, VIEW_PROGRAM_PERMISSION
Returns:
List[Program]: providers functions available to the user
Expand Down Expand Up @@ -118,7 +123,7 @@ def get_user_function(self, author, title: str) -> Function | None:
Args:
author: Django author from who retrieve the function
title: Title that the function must have to find it
title (str): Title that the function must have to find it
Returns:
Program | None: user function with the specific title
Expand Down Expand Up @@ -147,16 +152,18 @@ def get_provider_function_by_permission(
Returns the provider function associated to:
- A Function title
- A Provider
- Author must have view permission to see it or be the author
- Author must have a permission to see it or be the author
Args:
author: Django author from who retrieve the function
title: Title that the function must have to find it
provider: Provider associated to the function
permission_name (str): name of the permission. Values accepted
RUN_PROGRAM_PERMISSION, VIEW_PROGRAM_PERMISSION
title (str): Title that the function must have to find it
provider (str): the name of the provider
Returns:
Program | None: provider function with the specific
title and provider
title and provider
"""

# This access should be checked in the use-case but how we don't
Expand Down Expand Up @@ -193,10 +200,12 @@ def get_function_by_permission(
) -> None:
"""
This method returns the specified function if the user is
the author of the function or it has run permissions.
the author of the function or it has a permission.
Args:
user: Django user of the function that wants to get it
permission_name (str): name of the permission. Values accepted
RUN_PROGRAM_PERMISSION, VIEW_PROGRAM_PERMISSION
function_title (str): title of the function
provider_name (str | None): name of the provider owner of the function
Expand Down
4 changes: 2 additions & 2 deletions gateway/api/repositories/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def get_provider_by_name(self, name: str) -> Provider | None:
Returns the provider associated with a name.
Args:
name: provider name
- name: provider name
Returns:
Provider | None: returns the specific provider if it exists
- Provider | None: returns the specific provider if it exists
"""

provider = Provider.objects.filter(name=name).first()
Expand Down
2 changes: 1 addition & 1 deletion gateway/api/repositories/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_groups_by_permissions(self, user, permission_name: str) -> List[Group]:
Args:
user: Django user from the request
permission
permission_name (str): name of the permission by look for
Returns:
List[Group]: all the groups available to the user
Expand Down

0 comments on commit da9bf35

Please sign in to comment.