Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalog returns only the functions that you can run #1540

Merged
merged 9 commits into from
Nov 26, 2024
Merged

Conversation

Tansito
Copy link
Member

@Tansito Tansito commented Nov 22, 2024

Summary

This is PR continues the work done in #1526

The end-point that returns the list of the Functions for the Catalog is returning all the those Functions with view permission. This was generating some frustrations because view permission doesn't give you access to run them. So with this PR now we will return only those functions for what the user has run permission.

This PR also introduces a refactor around how GET end-points from Program view were managing the access to the model. With the purpose to continue adding good practices to the base code we are starting to introduce some new concepts:

  • Now the access to the model is being done through a Repository class. In this case we started with the get methods for the Program view. We will continue the refactor in future PR.
  • Swagger was updated
  • Now list end-point doesn't filter by title. We are doing that using the end-point get_by_title.
  • Updated test due to the change for the catalog filter.

@@ -49,7 +49,7 @@
"password": "pbkdf2_sha256$390000$kcex1rxhZg6VVJYkx71cBX$e4ns0xDykbO6Dz6j4nZ4uNusqkB9GVpojyegPv5/9KM=",
"is_active": true,
"groups": [
101
100
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to change the user group to the runner one that has the run permission.

author = self.request.user
type_filter = self.request.query_params.get("filter")

if type_filter == "serverless":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@korgan00 let's comment about these values, Monday. I think we can use the Enum approach that we used in the last PR but how they don't accept strings if we don't use StrEnum we will need to compare them in a different way probably.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@korgan00 I just solved it in 86d1c3a

and I could find a way to setup a Enum with strings for Python 3.9 👍

@Tansito Tansito marked this pull request as ready for review November 22, 2024 21:13
@Tansito Tansito requested a review from a team November 22, 2024 21:13
Copy link
Collaborator

@korgan00 korgan00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Tansito Tansito merged commit baf9026 into main Nov 26, 2024
10 checks passed
@Tansito Tansito deleted the run-list-catalog branch November 26, 2024 16:23
korgan00 pushed a commit that referenced this pull request Dec 9, 2024
* move program model access to repository

* remove unused code

* fix linter

* fixed tests

* update swagger information

* added logger in the repository class

* rename provider method

* added TypeFilter enum

* fix typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants