OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Create a new role with permissions.
Goal
Allow admins to define custom roles.
Context
Role management in admin settings.
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { ScalarTypeEnum, SchemaModel } from '@lssm-tech/lib.schema';
import { SuccessResultModel } from './user';
export const CreateRoleContract = defineCommand({
meta: {
key: 'identity.rbac.role.create',
version: '1.0.0',
stability: 'stable',
owners: ['@platform.identity-rbac'],
tags: ['identity', 'rbac', 'role', 'create'],
description: 'Create a new role with permissions.',
goal: 'Allow admins to define custom roles.',
context: 'Role management in admin settings.',
},
io: {
input: CreateRoleInputModel,
output: RoleModel,
errors: {
ROLE_EXISTS: {
description: 'A role with this name already exists',
http: 409,
gqlCode: 'ROLE_EXISTS',
when: 'Role name is taken',
},
},
},
policy: {
auth: 'admin',
},
sideEffects: {
audit: ['role.created'],
},
});