Phase 1 Steps 1-2: Database Schema & Core DAOs for User Accounts #91
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#91
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
This issue covers the foundational database work for implementing user accounts and permissions in the chatbot application. This includes creating all necessary database tables using JetBrains Exposed ORM and implementing the core Data Access Objects (DAOs) required for user identity and basic ownership.
Phase 1 - Foundation: Authentication & Private User Space
Goal: Establish the core user system, allowing users to register, log in, and see only their own private chat sessions and groups.
Step 1: Database Schema Setup
Tasks
New Tables to Implement
Core User Management Tables
UsersTable- User accounts with credentialsRolesTable- User roles (Admin, Standard User, etc.)PermissionsTable- Granular permissionsRolePermissionsTable- Links roles to permissionsUserRoleAssignmentsTable- Assigns roles to usersUserSessionsTable- Active user sessionsUserGroupsTable- User-defined groups (including special "All Users" group)UserGroupMembershipsTable- Links users to groupsOwnership Association Tables
ChatSessionOwnersTable- Links chat sessions to owning usersChatGroupOwnersTable- Links chat groups to owning usersLLMProviderOwnersTable- Links LLM providers to owning usersLLMModelOwnersTable- Links LLM models to owning usersModelSettingsOwnersTable- Links model settings to owning usersApiSecretOwnersTable- Links API secrets to owning usersAccess Association Tables
LLMProviderAccessTable- Defines group access to providersLLMModelAccessTable- Defines group access to modelsModelSettingsAccessTable- Defines group access to settingsKey Implementation Details
Migration Requirements
Step 2: Core Data Access Objects (DAOs)
Tasks
UserDaofor user CRUD operationsUserSessionDaofor session managementSessionOwnershipDaofor chat session ownershipGroupOwnershipDaofor chat group ownershipDAO Requirements
UserDao
insertUser(username, passwordHash, email): UsergetUserById(id): User?getUserByUsername(username): User?updateUser(id, updates): BooleandeleteUser(id): BooleanUserSessionDao
createSession(userId, expiresAt): UserSessiongetSessionById(id): UserSession?updateLastAccessed(sessionId, timestamp): BooleandeleteSession(sessionId): BooleandeleteExpiredSessions(): IntSessionOwnershipDao
getAllSessionsForUser(userId): List<ChatSession>getSessionOwner(sessionId): User?setOwner(sessionId, userId): BooleanverifyOwnership(sessionId, userId): BooleanGroupOwnershipDao
getAllGroupsForUser(userId): List<ChatGroup>getGroupOwner(groupId): User?setOwner(groupId, userId): BooleanverifyOwnership(groupId, userId): BooleanTechnical Requirements
File Locations
server/src/main/kotlin/eu/torvian/chatbot/server/data/tables/server/src/main/kotlin/eu/torvian/chatbot/server/data/dao/server/src/main/kotlin/eu/torvian/chatbot/server/data/dao/impl/server/src/main/kotlin/eu/torvian/chatbot/server/data/migrations/Acceptance Criteria
Dependencies
Notes
ChatSessionTable,LLMProviderTable, etc.) remain structurally unchangedRelated
docs/plans/user accounts/User Accounts feature.md