Skip to content
New issue

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

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

Already on GitHub? # to your account

Add optional additional entities to authz request #25

Merged
merged 2 commits into from
Jan 28, 2024

Conversation

sliiser
Copy link
Contributor

@sliiser sliiser commented Dec 13, 2023

Added an option to pass in entities to authorization requests that would not overwrite the configuration already stored in memory, but modify it by adding new entities to it.

Should be used if your use case has a large amount of entities that is infeasible to store in memory and you have easy access to all relevant entities when making the authorization request.

Fixes #22

This is my first Rust PR. Open and welcoming to feedback.

Would have added tests if the architecture was set up already. Sadly, for integration tests it is not and unit tests are meaningless here.

Added an option to pass in entities to authorization requests that would
not overwrite the configuration already stored in memory, but modify it
by adding new entities to it.

Should be used if your use case has a large amount of entities that is
infeasible to store in memory and you have easy access to all relevant
entities when making the authorization request.
Copy link
Collaborator

@omer9564 omer9564 left a comment

Choose a reason for hiding this comment

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

It looks good in general.
I understand that you didn't implement tests because this happens in the API layer and we currently only have tests for the service layer.
I do think you can still create tests here,
you can extract the new behavior to a function and create unit test for that function.

besides that, we currently don't have CI to run the test so we run them manually, please attach a screenshot of the successfully running tests after your changes :)

@sliiser
Copy link
Contributor Author

sliiser commented Jan 3, 2024

Extracted the new behaviour and the existing entities override to a function and added a test.

Attached is console output of a test run. Plenty of warnings unrelated to these changes, but all tests pass.

test_run_output.txt

Copy link
Collaborator

@omer9564 omer9564 left a comment

Choose a reason for hiding this comment

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

LGTM, will merge it this week :)

@omer9564 omer9564 merged commit c0d271d into permitio:main Jan 28, 2024
@sliiser sliiser deleted the additional-entities branch January 30, 2024 11:16
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing additional entities to POST /is_authorized endpoint
2 participants