feat(api, web): integrate pod routes and user hierarchy management
- Added pod routes to the API and registered them in the app. - Implemented user hierarchy management with new database tables for user relationships and pod settings. - Enhanced user detail and grid components to support pod settings, including the ability to create child users and manage their limits. - Updated authentication guards to include pod-specific authorization checks. - Improved user interface for managing pod access and settings in the user detail sheet and grid view. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -97,8 +97,22 @@ export function migrateSchema(sqlite: Sqlite): void {
|
||||
created_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_hierarchy (
|
||||
child_username TEXT PRIMARY KEY NOT NULL,
|
||||
parent_username TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_pod_settings (
|
||||
username TEXT PRIMARY KEY NOT NULL,
|
||||
can_create_children INTEGER NOT NULL DEFAULT 0,
|
||||
max_children INTEGER NOT NULL DEFAULT 0,
|
||||
updated_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_jobs_agent ON jobs(agent_id, status);
|
||||
CREATE INDEX IF NOT EXISTS idx_agents_status ON agents(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_audit_created ON audit_log(created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_hierarchy_parent ON user_hierarchy(parent_username);
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -67,3 +67,20 @@ export const auditLog = sqliteTable('audit_log', {
|
||||
detailsJson: text('details_json'),
|
||||
createdAt: text('created_at').notNull(),
|
||||
})
|
||||
|
||||
/** Telemt user hierarchy (panel-only; Telemt /v1 has no parent/child). */
|
||||
export const userHierarchy = sqliteTable('user_hierarchy', {
|
||||
childUsername: text('child_username').primaryKey(),
|
||||
parentUsername: text('parent_username').notNull(),
|
||||
createdAt: text('created_at').notNull(),
|
||||
})
|
||||
|
||||
/** Pod portal quotas for root (master) Telemt users. */
|
||||
export const userPodSettings = sqliteTable('user_pod_settings', {
|
||||
username: text('username').primaryKey(),
|
||||
canCreateChildren: integer('can_create_children', { mode: 'boolean' })
|
||||
.notNull()
|
||||
.default(false),
|
||||
maxChildren: integer('max_children').notNull().default(0),
|
||||
updatedAt: text('updated_at').notNull(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user