mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-12 16:01:35 +08:00
新增用户权限管理功能
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import type { userState } from '@/stores/types'
|
||||
import { DEFAULT_PERMISSIONS } from '@/utils/permission'
|
||||
|
||||
export const useUserStore = defineStore('user', {
|
||||
state: (): userState => ({
|
||||
@@ -8,7 +9,7 @@ export const useUserStore = defineStore('user', {
|
||||
userName: '',
|
||||
avatar: '',
|
||||
level: 1,
|
||||
permissions: {},
|
||||
permissions: DEFAULT_PERMISSIONS,
|
||||
}),
|
||||
|
||||
// 全局持久化
|
||||
@@ -31,7 +32,7 @@ export const useUserStore = defineStore('user', {
|
||||
this.level = level
|
||||
},
|
||||
setPermissions(permissions: object) {
|
||||
this.permissions = permissions
|
||||
this.permissions = { ...DEFAULT_PERMISSIONS, ...permissions }
|
||||
},
|
||||
loginUser(payload: userState) {
|
||||
this.setSuperUser(payload.superUser)
|
||||
@@ -47,7 +48,7 @@ export const useUserStore = defineStore('user', {
|
||||
this.setUserName('')
|
||||
this.setAvatar('')
|
||||
this.setLevel(1)
|
||||
this.setPermissions({})
|
||||
this.setPermissions(DEFAULT_PERMISSIONS)
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user