ListRoleAssignments
Lists role assignments for a group or resource.
Use this method to:
- View all role assignments for a group
- Audit resource access
- Check which groups have access to resources
Examples
-
List role assignments for a group:
Shows all role assignments for a specific group.
filter: groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" pagination: pageSize: 20 -
List role assignments by resource type:
Shows all role assignments for runners.
filter: resourceTypes: - RESOURCE_TYPE_RUNNER pagination: pageSize: 20
Authorization
All organization members can view role assignments (transparency model).
ParametersExpand Collapse
params GroupRoleAssignmentListParams
Body param: Filter parameters
Body param: Filter parameters
group_id filters the response to only role assignments for this specific group Empty string is allowed and means no filtering by group
Filters by a single resource. Non-admin callers with :grant permission on the resource can see role assignments from groups they don’t belong to. Mutually exclusive with resource_ids.
Filters by multiple resources in a single request. Non-admin callers with :grant permission on a resource can see all role assignments for that resource, even from groups they don’t belong to. The :grant check is applied per-resource within the batch. Mutually exclusive with resource_id.
resource_roles filters the response to only role assignments with these specific roles
resource_roles filters the response to only role assignments with these specific roles
resource_types filters the response to only role assignments for these resource types
resource_types filters the response to only role assignments for these resource types
ReturnsExpand Collapse
type RoleAssignment struct{…}RoleAssignment represents a role assigned to a group on a specific resource
RoleAssignment represents a role assigned to a group on a specific resource
The org-level role that created this assignment, if any.
RESOURCE_ROLE_UNSPECIFIED means this is a direct share (manually created).
Non-zero (e.g., ORG_PROJECTS_ADMIN, ORG_RUNNERS_ADMIN) means this
assignment was derived from an org-level role.
The org-level role that created this assignment, if any. RESOURCE_ROLE_UNSPECIFIED means this is a direct share (manually created). Non-zero (e.g., ORG_PROJECTS_ADMIN, ORG_RUNNERS_ADMIN) means this assignment was derived from an org-level role.
Role assigned to the group on this resource
Role assigned to the group on this resource
Type of resource (runner, project, environment, etc.)
Type of resource (runner, project, environment, etc.)
ListRoleAssignments
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
"github.com/gitpod-io/gitpod-sdk-go/shared"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
page, err := client.Groups.RoleAssignments.List(context.TODO(), gitpod.GroupRoleAssignmentListParams{
Filter: gitpod.F(gitpod.GroupRoleAssignmentListParamsFilter{
ResourceTypes: gitpod.F([]shared.ResourceType{shared.ResourceTypeRunner}),
}),
Pagination: gitpod.F(gitpod.GroupRoleAssignmentListParamsPagination{
PageSize: gitpod.F(int64(20)),
}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
{
"assignments": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"derivedFromOrgRole": "RESOURCE_ROLE_UNSPECIFIED",
"groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"resourceId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"resourceRole": "RESOURCE_ROLE_UNSPECIFIED",
"resourceType": "RESOURCE_TYPE_UNSPECIFIED"
}
],
"pagination": {
"nextToken": "nextToken"
}
}Returns Examples
{
"assignments": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"derivedFromOrgRole": "RESOURCE_ROLE_UNSPECIFIED",
"groupId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"resourceId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"resourceRole": "RESOURCE_ROLE_UNSPECIFIED",
"resourceType": "RESOURCE_TYPE_UNSPECIFIED"
}
],
"pagination": {
"nextToken": "nextToken"
}
}