refactor(auth): remove Guest role from user type system
Remove all references to 'Guest' user type from the codebase, simplifying the role system to only support 'Admin' and 'User' roles. Changes: - Update type definitions to exclude 'Guest' from UserType - Remove isGuest() method from SessionManager - Remove Guest-specific logic from update services - Update all type assertions from 'Admin | User | Guest' to 'Admin | User' - Remove Guest UI styling from UserSelectionDialog - Replace Guest fallback with ValidationError in settings handler Error handling: - Zod schema now rejects 'Guest' as invalid user type - TypeScript will fail compilation if 'Guest' is referenced - Runtime errors occur if database contains Guest users No database migration needed (confirmed: no Guest users exist) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ import { Modal } from './ui/Modal'
|
||||
export interface UserInfo {
|
||||
id: number
|
||||
username: string
|
||||
userType: 'Admin' | 'User' | 'Guest'
|
||||
userType: 'Admin' | 'User'
|
||||
createTime?: Date
|
||||
}
|
||||
|
||||
@@ -61,8 +61,7 @@ export const UserSelectionDialog: React.FC<UserSelectionDialogProps> = ({
|
||||
|
||||
const userTypeStyles: Record<string, string> = {
|
||||
Admin: 'bg-amber-50 text-amber-600',
|
||||
User: 'bg-blue-50 text-blue-600',
|
||||
Guest: 'bg-gray-100 text-gray-600'
|
||||
User: 'bg-blue-50 text-blue-600'
|
||||
}
|
||||
|
||||
if (!isOpen) return null
|
||||
|
||||
@@ -4,7 +4,7 @@ import UserSelectionDialog, { type UserInfo as SelectedUserInfo } from '../UserS
|
||||
|
||||
interface CurrentUser {
|
||||
username: string
|
||||
userType: 'Admin' | 'User' | 'Guest'
|
||||
userType: 'Admin' | 'User'
|
||||
}
|
||||
|
||||
interface UnauthenticatedAppProps {
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface CurrentUser {
|
||||
export interface SelectedUserInfo {
|
||||
id: number
|
||||
username: string
|
||||
userType: 'Admin' | 'User' | 'Guest'
|
||||
userType: 'Admin' | 'User'
|
||||
computerName?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState, useCallback } from 'react'
|
||||
interface UserInfo {
|
||||
id: number
|
||||
username: string
|
||||
userType: 'Admin' | 'User' | 'Guest'
|
||||
userType: 'Admin' | 'User'
|
||||
computerName?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { create } from 'zustand'
|
||||
interface UserInfo {
|
||||
id: number
|
||||
username: string
|
||||
userType: 'Admin' | 'User' | 'Guest'
|
||||
userType: 'Admin' | 'User'
|
||||
computerName?: string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user