-
Notifications
You must be signed in to change notification settings - Fork 156
Roles support #313
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
Roles support #313
Conversation
f555caa
to
d1f37b3
Compare
This looks good, but appears to be missing support for scoping unless I've missed something? From their example:
|
You're right, I've added permission scope to the grant permission requests |
Data *Organization `json:"data,omitempty"` | ||
} | ||
|
||
// TODO: Fill this out with everything you can get back when getting an organization |
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.
❓
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.
This was just a comment that there's much more to Organizations than an ID, but that's all I needed for this implementation. I can easily delete the comment or create an issue for adding Organizations support.
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 worry that it is a bit early for the role permission API to be solidified in the public client. Can we postpone implementing this API while we roadmap the APIs definition internally. Roles Users and Permissions are good to go.
roles.go
Outdated
SortNameAsc Sort = "name" | ||
SortNameDesc Sort = "-name" | ||
SortModifiedAtAsc Sort = "modified_at" | ||
SortModifiedAtDesc Sort = "-modified_at" | ||
SortUserCountAsc Sort = "user_count" | ||
SortUserCountDesc Sort = "-user_count" |
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.
What about adding SortRolesBy...
?
I feel like anything posted in https://docs.datadoghq.com/api should be stable enough to write into an SDK. The caveat being that you then have to maintain that feature in the SDK as the API evolves. |
permissions.go
Outdated
permissionRequest := Permission{ | ||
Type: String("permissions"), | ||
Id: String(permissionId), | ||
Scope: scope, |
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.
Apologies for the confusion - after investigation earlier we realized the Roles V2 API does not currently support Scope. To use Scope you should use the Roles V1 API.
permissions_test.go
Outdated
} | ||
} | ||
|
||
func TestClient_GrantScopedRolePermission(t *testing.T) { |
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.
Like above, to use Scoped Permissions you should test against the Roles V1 API.
Apologies on letting this sit, I'll take care of the PR comments later tonight |
* Added code to allow for performing CRUD operations on a role * Added code to allow granting and revoking permissions on a role * Added code to add or remove users on a role * Initial unit tests
* Added remaining role CRUD tests * Added permissions tests
* Ensuring all role methods have at least one unit test * Splitting permissions and organizations data types and methods into their own files
These files should not have ever been added Also enhancing git ignore file to ensure other useless files don't get added
* Removed unnecessary print statement * Reverted git ignore to previous state, will open a new PR with those changes
ea5e21f
to
d380491
Compare
Enabling the SDK to perform CRUD operations on Roles as well as manage permissions and users on those roles.
Fixes: #307