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:
@@ -139,7 +139,7 @@ export class BIPUsersDAO {
|
||||
return {
|
||||
id: row.ID as number,
|
||||
username: row.UserName as string,
|
||||
userType: row.UserType as 'Admin' | 'User' | 'Guest'
|
||||
userType: row.UserType as 'Admin' | 'User'
|
||||
}
|
||||
}
|
||||
return null
|
||||
@@ -157,7 +157,7 @@ export class BIPUsersDAO {
|
||||
return {
|
||||
id: row.ID as number,
|
||||
username: row.UserName as string,
|
||||
userType: row.UserType as 'Admin' | 'User' | 'Guest'
|
||||
userType: row.UserType as 'Admin' | 'User'
|
||||
}
|
||||
}
|
||||
return null
|
||||
@@ -198,7 +198,7 @@ export class BIPUsersDAO {
|
||||
return {
|
||||
id: row.ID as number,
|
||||
username: row.UserName as string,
|
||||
userType: row.UserType as 'Admin' | 'User' | 'Guest'
|
||||
userType: row.UserType as 'Admin' | 'User'
|
||||
}
|
||||
}
|
||||
return null
|
||||
@@ -216,7 +216,7 @@ export class BIPUsersDAO {
|
||||
return {
|
||||
id: row.ID as number,
|
||||
username: row.UserName as string,
|
||||
userType: row.UserType as 'Admin' | 'User' | 'Guest'
|
||||
userType: row.UserType as 'Admin' | 'User'
|
||||
}
|
||||
}
|
||||
return null
|
||||
@@ -254,7 +254,7 @@ export class BIPUsersDAO {
|
||||
return result.rows.map((row) => ({
|
||||
id: row.ID as number,
|
||||
username: row.UserName as string,
|
||||
userType: row.UserType as 'Admin' | 'User' | 'Guest',
|
||||
userType: row.UserType as 'Admin' | 'User',
|
||||
createTime: row.CreateTime as Date | undefined
|
||||
}))
|
||||
} catch (error) {
|
||||
@@ -270,7 +270,7 @@ export class BIPUsersDAO {
|
||||
* Create a new user
|
||||
* @param username - The username (must be unique)
|
||||
* @param password - The password
|
||||
* @param userType - User type ('Admin', 'User', or 'Guest')
|
||||
* @param userType - User type ('Admin' or 'User')
|
||||
* @param computerName - Optional computer name for silent login
|
||||
* @returns True if successful
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user