import { SmrtObject, SmrtObjectOptions } from '@happyvertical/smrt-core'; import { Role as RoleContract } from '@happyvertical/smrt-types'; /** * Constructor options for {@link Role}. */ export interface RoleOptions extends SmrtObjectOptions { tenantId?: string | null; name?: string; description?: string; isSystem?: boolean; inheritsToDescendants?: boolean; } /** * Role represents a permission template that can be assigned to users. * * Roles can be: * - System roles (tenantId = null): Available to all tenants, cannot be modified * - Custom roles (tenantId set): Specific to a tenant, can be customized * * @example * ```typescript * // System role (tenantId = null) * const adminRole = await roles.create({ * slug: 'admin', * name: 'Administrator', * isSystem: true * }); * * // Custom tenant role * const editorRole = await roles.create({ * tenantId: tenant.id, * slug: 'editor', * name: 'Editor', * description: 'Can edit content' * }); * ``` */ export declare class Role extends SmrtObject implements RoleContract { /** * Foreign key to Tenant * null = system role available to all tenants */ tenantId?: string | null; /** * Display name for the role */ name: string; /** * Description of the role */ description: string; /** * Whether this is a system role (cannot be deleted) */ isSystem: boolean; /** * Opt-in hierarchical inheritance: when true, an ACTIVE membership holding * this role also resolves permissions in descendant tenants where the user * has no direct membership (nearest flagged ancestor membership wins). * * Default false: the role's authority is exact-tenant only, which is the * pre-existing resolver behavior. Flag structural roles like a network-level * owner/admin; leave per-tenant roles like member/viewer unflagged. */ inheritsToDescendants: boolean; constructor(options?: RoleOptions); /** * Check if this is a system-wide role */ isSystemRole(): boolean; /** * Check if this is a tenant-specific role */ isTenantRole(): boolean; /** * Check if this role can be deleted. * System roles (isSystem = true) cannot be deleted. * @returns true if the role can be deleted */ canDelete(): boolean; /** * Delete guard - prevents deletion of system roles. * Override the delete method to check isSystem flag first. */ delete(): Promise; } //# sourceMappingURL=Role.d.ts.map