Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #169 from grafana/sa-permission-code
Browse files Browse the repository at this point in the history
Service accounts: use ID not UID when fetching service account permissions
  • Loading branch information
IevaVasiljeva authored Nov 8, 2023
2 parents b041ab2 + 3abeed2 commit 3007752
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions service_account_permissions.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package gapi

func (c *Client) ListServiceAccountResourcePermissions(uid string) ([]*ResourcePermission, error) {
return c.listResourcePermissions(ServiceAccountsResource, ResourceUID(uid))
func (c *Client) ListServiceAccountResourcePermissions(id int64) ([]*ResourcePermission, error) {
return c.listResourcePermissions(ServiceAccountsResource, ResourceID(id))
}

func (c *Client) SetServiceAccountResourcePermissions(uid string, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissions(ServiceAccountsResource, ResourceUID(uid), body)
func (c *Client) SetServiceAccountResourcePermissions(id int64, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissions(ServiceAccountsResource, ResourceID(id), body)
}

func (c *Client) SetUserServiceAccountResourcePermissions(serviceAccountUID string, userID int64, permission string) (*SetResourcePermissionsResponse, error) {
func (c *Client) SetUserServiceAccountResourcePermissions(id int64, userID int64, permission string) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissionByAssignment(
ServiceAccountsResource,
ResourceUID(serviceAccountUID),
ResourceID(id),
UsersResource,
ResourceID(userID),
SetResourcePermissionBody{
Expand All @@ -23,10 +23,10 @@ func (c *Client) SetUserServiceAccountResourcePermissions(serviceAccountUID stri
)
}

func (c *Client) SetTeamServiceAccountResourcePermissions(serviceAccountUID string, teamID int64, permission string) (*SetResourcePermissionsResponse, error) {
func (c *Client) SetTeamServiceAccountResourcePermissions(id int64, teamID int64, permission string) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissionByAssignment(
ServiceAccountsResource,
ResourceUID(serviceAccountUID),
ResourceID(id),
TeamsResource,
ResourceID(teamID),
SetResourcePermissionBody{
Expand Down

0 comments on commit 3007752

Please sign in to comment.