-
Notifications
You must be signed in to change notification settings - Fork 20
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 role parameter in check command in API #153
Conversation
dbaae4b
to
0186678
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments. Otherwise I think this has the behaviour we want
conjurapi/resource.go
Outdated
@@ -16,8 +16,8 @@ type ResourceFilter struct { | |||
|
|||
// CheckPermission determines whether the authenticated user has a specified privilege | |||
// on a resource. | |||
func (c *Client) CheckPermission(resourceID, privilege string) (bool, error) { | |||
req, err := c.CheckPermissionRequest(resourceID, privilege) | |||
func (c *Client) CheckPermission(resourceID string, roleID string, privilege string) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking maybe we should retain CheckPermission
and introduce CheckPermissionForRole
. Something off about giving special meaning to roleId
being an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented CheckPermissionForRole
and CheckPermissionForRoleRequest
conjurapi/client.go
Outdated
if tokens[0] != c.config.Account { | ||
return "", "", "", fmt.Errorf("Account of '%s' must match the configured account '%s'", id, c.config.Account) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be too strict and we likely don't have to do this. Mainly because I'm still not 100% sure if it's not possible to make permission queries across accounts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled this error case from the RotateApiKeyRequest
implementation - is this validation required in that context, or can it be removed all together? (EDIT: pulled out the error either way)
9dec532
to
90d060e
Compare
13dec96
to
3582065
Compare
When an account is not specified, the configured account is used.
3582065
to
4d89632
Compare
Code Climate has analyzed commit 4d89632 and detected 4 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 96.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 74.2% (0.5% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Took on this PR myself and addressed my own suggestions
Desired Outcome
This pull request implements the API side of adding the role parameter into the 'check' command for the Go CLI.
Implemented Changes
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog (need a Changelog)
CHANGELOG update
Test coverage
changes, or
Documentation
README
s) were updated in this PRBehavior
Security