Skip to content
Ona Docs

SetRole

client.organizations.setRole(OrganizationSetRoleParams { organizationId, userId, role } body, RequestOptionsoptions?): OrganizationSetRoleResponse
POST/gitpod.v1.OrganizationService/SetRole

Manages organization membership and roles by setting a user’s role within the organization.

Use this method to:

  • Promote members to admin role
  • Change member permissions
  • Demote admins to regular members

Examples

  • Promote to admin:

    Makes a user an organization administrator.

    organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
    userId: "f53d2330-3795-4c5d-a1f3-453121af9c60"
    role: ORGANIZATION_ROLE_ADMIN
  • Change to member:

    Changes a user’s role to regular member.

    organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
    userId: "f53d2330-3795-4c5d-a1f3-453121af9c60"
    role: ORGANIZATION_ROLE_MEMBER
ParametersExpand Collapse
body: OrganizationSetRoleParams { organizationId, userId, role }
organizationId: string
formatuuid
userId: string
formatuuid
One of the following:
"ORGANIZATION_ROLE_UNSPECIFIED"
"ORGANIZATION_ROLE_ADMIN"
"ORGANIZATION_ROLE_MEMBER"
ReturnsExpand Collapse
OrganizationSetRoleResponse = unknown

SetRole

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const response = await client.organizations.setRole({
  organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047',
  userId: 'f53d2330-3795-4c5d-a1f3-453121af9c60',
  role: 'ORGANIZATION_ROLE_MEMBER',
});

console.log(response);
{}
Returns Examples
{}