Function
createRole
({
name,
description,
type,
isDefault,
scopeIds,
}: {
name?: string;
description?: string;
type?: RoleType;
isDefault?: boolean;
scopeIds?: string[];
})
Source from the content-addressed store, hash-verified
| 13 | }; |
| 14 | |
| 15 | export const createRole = async ({ |
| 16 | name, |
| 17 | description, |
| 18 | type, |
| 19 | isDefault, |
| 20 | scopeIds, |
| 21 | }: { |
| 22 | name?: string; |
| 23 | description?: string; |
| 24 | type?: RoleType; |
| 25 | isDefault?: boolean; |
| 26 | scopeIds?: string[]; |
| 27 | }) => |
| 28 | authedAdminApi |
| 29 | .post('roles', { |
| 30 | json: { |
| 31 | name: name ?? generateRoleName(), |
| 32 | description: description ?? generateRoleName(), |
| 33 | isDefault, |
| 34 | type: type ?? RoleType.User, |
| 35 | scopeIds, |
| 36 | }, |
| 37 | }) |
| 38 | .json<Role>(); |
| 39 | |
| 40 | export const getRoles = async (options?: GetRoleOptions) => |
| 41 | authedAdminApi.get('roles', { searchParams: new URLSearchParams(options) }).json<Role[]>(); |