refactor(auth): remove bot owner linkage and enforce bot-level permissions
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
This document defines the database schema in an AI-agent-friendly format.
|
||||
|
||||
- Source of truth: Alembic revisions in `migrations/versions`
|
||||
- Current baseline revision: `20260403_0006`
|
||||
- Current baseline revision: `20260403_0007`
|
||||
- Baseline files:
|
||||
- `migrations/versions/20260403_0001_initial_portfolio_schema.py`
|
||||
- `migrations/versions/20260403_0002_strategy_set_columns.py`
|
||||
@@ -13,6 +13,7 @@ This document defines the database schema in an AI-agent-friendly format.
|
||||
- `migrations/versions/20260403_0004_users_table.py`
|
||||
- `migrations/versions/20260403_0005_auth_user_fields_and_tokens.py`
|
||||
- `migrations/versions/20260403_0006_bot_principals_and_bot_tokens.py`
|
||||
- `migrations/versions/20260403_0007_bot_principal_permission_only.py`
|
||||
|
||||
## 2. Scope
|
||||
|
||||
@@ -101,8 +102,8 @@ Columns:
|
||||
| Column | Type | Null | Default | Constraints / Notes |
|
||||
|---|---|---|---|---|
|
||||
| id | Text | NO | - | Primary Key |
|
||||
| owner_user_id | Text | NO | - | Logical owner reference to users.id |
|
||||
| name | Text | NO | - | Unique bot name |
|
||||
| permission | Text | NO | - | Bot permission ceiling |
|
||||
| description | Text | YES | - | Optional operator description |
|
||||
| is_active | Boolean | NO | TRUE | When false, bot tokens are rejected |
|
||||
| created_at | DateTime(timezone=True) | NO | NOW() | Creation timestamp |
|
||||
@@ -292,3 +293,4 @@ When schema changes:
|
||||
| 20260403_0004 | migrations/versions/20260403_0004_users_table.py | Add `users` table with unique username/email and created_at index |
|
||||
| 20260403_0005 | migrations/versions/20260403_0005_auth_user_fields_and_tokens.py | Add password/permission/login fields to `users` and create `auth_tokens` table |
|
||||
| 20260403_0006 | migrations/versions/20260403_0006_bot_principals_and_bot_tokens.py | Add `bot_principals` table and `auth_tokens.bot_principal_id` for bot API key management |
|
||||
| 20260403_0007 | migrations/versions/20260403_0007_bot_principal_permission_only.py | Remove `bot_principals.owner_user_id` and enforce bot-local `permission` model |
|
||||
|
||||
Reference in New Issue
Block a user