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

Implements 'check' command in API #34

Merged
merged 1 commit into from
Aug 15, 2022
Merged

Conversation

juniortaeza
Copy link
Contributor

@juniortaeza juniortaeza commented Aug 5, 2022

Desired Outcome

Added functionality for the check command in the API side

Implemented Changes

  • Updated api.py
  • Updated endpoints.py
  • Updated client.py
  • Updated .gitignore
  • Updated test_unit_client.py
  • Updated test_unit_endpoints.py
  • Updated README.md
  • Updated CHANGELOG.md

Connected Issue/Story

ONYX-23082

@juniortaeza juniortaeza requested review from szh and gl-johnson August 5, 2022 21:57
@juniortaeza juniortaeza requested a review from a team as a code owner August 5, 2022 21:57
Copy link
Contributor

@gl-johnson gl-johnson left a comment

Choose a reason for hiding this comment

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

Added a couple inline comments. In addition you would need to add the following:

  • Update the README and CHANGELOG with your additions
  • Add unit test(s) to verify that check_privilege is hitting the Conjur API as expected. Check the CONTRIBUTING docs in this repo for more info on running tests locally.
  • In your cyberark-conjur-cli PR, add integration tests which validate the behavior of this branch.

Also feel free to reference similar PRs which have gone in recently.
resource_exists
role_memberships

conjur_api/http/api.py Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
.DS_Store
Copy link
Contributor Author

Choose a reason for hiding this comment

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

retained .gitignore updates

@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [8.0.0] - 2022-05-25

### Added
- Add support for Check Privilege endpoint
[conjur-api-python#34](https://github.com/cyberark/conjur-api-python/pull/34)
Copy link
Contributor Author

@juniortaeza juniortaeza Aug 8, 2022

Choose a reason for hiding this comment

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

updated CHANGELOG.md with my additions

README.md Show resolved Hide resolved
@@ -182,8 +182,9 @@ async def check_privilege(self, kind: str, resource_id: str, privilege: str, rol
if err.status == 404:
return False

return True
raise
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added the raise to handle other error codes

@juniortaeza juniortaeza force-pushed the check-command-branch branch from 6e11904 to 95ebbcd Compare August 8, 2022 21:03
@juniortaeza juniortaeza changed the title Checkpoint1: implemented 'check' command in API side Implements 'check' command in API Aug 8, 2022
@juniortaeza juniortaeza force-pushed the check-command-branch branch from 139d560 to 3f4d645 Compare August 9, 2022 14:20
szh
szh previously requested changes Aug 10, 2022
Copy link
Contributor

@szh szh left a comment

Choose a reason for hiding this comment

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

Looks fantastic overall. Just left a couple minor suggestions.

README.md Show resolved Hide resolved
Comment on lines 180 to 181
if err.status == 401:
return False
Copy link
Contributor

Choose a reason for hiding this comment

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

I think 401 should only happen if there's an authentication error, see the conjur docs. This should presumably be raised as an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in most recent update

@juniortaeza juniortaeza force-pushed the check-command-branch branch from 945e1b7 to 34f66a8 Compare August 10, 2022 14:08
Copy link
Contributor

@szh szh left a comment

Choose a reason for hiding this comment

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

A couple more minor comments

conjur_api/http/api.py Outdated Show resolved Hide resolved
conjur_api/http/api.py Outdated Show resolved Hide resolved
@juniortaeza juniortaeza force-pushed the check-command-branch branch 4 times, most recently from adb7a6f to a72e466 Compare August 15, 2022 15:51
@juniortaeza juniortaeza force-pushed the check-command-branch branch from febbc78 to bc5e667 Compare August 15, 2022 16:28
Copy link
Contributor

@gl-johnson gl-johnson left a comment

Choose a reason for hiding this comment

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

LGTM!

@juniortaeza juniortaeza merged commit 6cc97f8 into main Aug 15, 2022
@juniortaeza juniortaeza deleted the check-command-branch branch August 15, 2022 16:42
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.

3 participants