v0.12.0 - Add modular system architecture with user-based module access
- Add Modules and UserModules database tables - Create home page with module selection grid - Implement per-user module assignment in user management - Add route guards for module access control - Refactor navigation: login -> home -> modules, admin console via button - Add Font Awesome icons
This commit is contained in:
@@ -31,7 +31,36 @@ def init_database():
|
||||
created_timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
''')
|
||||
|
||||
|
||||
# Modules Table - defines available system modules
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS Modules (
|
||||
module_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
module_name TEXT UNIQUE NOT NULL,
|
||||
module_key TEXT UNIQUE NOT NULL,
|
||||
description TEXT,
|
||||
icon TEXT,
|
||||
is_active INTEGER DEFAULT 1,
|
||||
display_order INTEGER DEFAULT 0
|
||||
)
|
||||
''')
|
||||
|
||||
# UserModules Table - which modules each user can access
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS UserModules (
|
||||
user_module_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
module_id INTEGER NOT NULL,
|
||||
granted_by INTEGER,
|
||||
granted_timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES Users(user_id),
|
||||
FOREIGN KEY (module_id) REFERENCES Modules(module_id),
|
||||
FOREIGN KEY (granted_by) REFERENCES Users(user_id),
|
||||
UNIQUE(user_id, module_id)
|
||||
)
|
||||
''')
|
||||
|
||||
|
||||
# CountSessions Table
|
||||
# NOTE: current_baseline_version removed - CURRENT is now global
|
||||
cursor.execute('''
|
||||
|
||||
Reference in New Issue
Block a user