ListRoleAssignments
client.groups.roleAssignments.list(RoleAssignmentListParams { token, pageSize, filter, pagination } params, RequestOptionsoptions?): AssignmentsPage<RoleAssignment { id, derivedFromOrgRole, groupId, 4 more } >
POST/gitpod.v1.GroupService/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).
ListRoleAssignments
import Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const roleAssignment of client.groups.roleAssignments.list({
filter: { resourceTypes: ['RESOURCE_TYPE_RUNNER'] },
pagination: { pageSize: 20 },
})) {
console.log(roleAssignment.id);
}{
"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"
}
}