Pular para o conteúdo

RoleService

Este conteúdo não está disponível em sua língua ainda.

Manages roles and their associated permissions within an organization. System roles (Admin, Manager, Member, Super Admin) are immutable.

MethodDescription
ListRolesList all roles for the organization
CreateRoleCreate a custom role
UpdateRoleUpdate a custom role
DeleteRoleDelete a custom role

List all roles for the organization, including system roles.

Authorization: Requires VIEW_ROLES permission

Empty request.

FieldTypeDescription
rolesRole[]List of roles.

Create a custom role with a set of permissions.

Authorization: Requires MANAGE_ROLES permission

FieldTypeDescription
namestringRole name. Max 200 characters.
permissionsPermission[]Permissions to grant.
FieldTypeDescription
roleRoleThe created role.

TypeScript (Connect-Web)

const response = await roleClient.createRole({
name: "Campaign Manager",
permissions: [
Permission.VIEW_CAMPAIGNS,
Permission.MANAGE_CAMPAIGNS,
Permission.VIEW_MEMBERS,
],
});

Go (gRPC)

resp, err := roleClient.CreateRole(ctx, &pidgrv1.CreateRoleRequest{
Name: "Campaign Manager",
Permissions: []pidgrv1.Permission{
pidgrv1.Permission_VIEW_CAMPAIGNS,
pidgrv1.Permission_MANAGE_CAMPAIGNS,
pidgrv1.Permission_VIEW_MEMBERS,
},
})

Update a custom role’s name or permissions. System roles cannot be updated.

Authorization: Requires MANAGE_ROLES permission

FieldTypeDescription
idstringRole ID.
namestringUpdated name.
permissionsPermission[]Updated permissions.
FieldTypeDescription
roleRoleThe updated role.

Delete a custom role. System roles and roles with assigned users cannot be deleted.

Authorization: Requires MANAGE_ROLES permission

FieldTypeDescription
idstringRole ID to delete.

Empty response on success.

FieldTypeDescription
idstringUnique identifier.
slugstringURL-safe slug (e.g., admin, manager).
namestringDisplay name.
is_defaultboolWhether this is a system-seeded role.
is_systemboolWhether this role is immutable (e.g., super_admin).
permissionsPermission[]Granted permissions.