refactor: update default password configuration key and improve model field formatting
This commit is contained in:
parent
c4df5cea5f
commit
414769f42d
@ -182,6 +182,9 @@ class UserManage(APIView):
|
||||
operation_id=_("Get default password"), # type: ignore
|
||||
tags=[_("User Management")], # type: ignore
|
||||
responses=UserPasswordResponse.get_response())
|
||||
@has_permissions(PermissionConstants.USER_CREATE, PermissionConstants.CHAT_USER_CREATE,
|
||||
PermissionConstants.WORKSPACE_CHAT_USER_CREATE, RoleConstants.ADMIN,
|
||||
RoleConstants.WORKSPACE_MANAGE)
|
||||
def get(self, request: Request):
|
||||
return result.success(data={'password': default_password})
|
||||
|
||||
|
||||
@ -73,6 +73,9 @@ const useUserStore = defineStore('user', {
|
||||
}
|
||||
},
|
||||
|
||||
is_admin() {
|
||||
return this.userInfo?.role.includes('ADMIN')
|
||||
},
|
||||
showXpack() {
|
||||
return this.edition != 'CE'
|
||||
},
|
||||
@ -91,7 +94,7 @@ const useUserStore = defineStore('user', {
|
||||
isEE() {
|
||||
return this.edition == 'EE' && this.license_is_valid
|
||||
},
|
||||
getEditionName() {
|
||||
getEditionName() {画
|
||||
return this.edition
|
||||
},
|
||||
async profile(loading?: Ref<boolean>) {
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
import {RoleTypeEnum} from '@/enums/system'
|
||||
import {t} from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
|
||||
const {user} = useStore()
|
||||
export const roleTypeMap: Record<RoleTypeEnum, string> = {
|
||||
...(user.is_admin()
|
||||
? {
|
||||
[RoleTypeEnum.ADMIN]: t('views.role.systemAdmin'),
|
||||
[RoleTypeEnum.USER]: t('views.role.user'),
|
||||
[RoleTypeEnum.WORKSPACE_MANAGE]: t('views.role.workspaceAdmin')
|
||||
}
|
||||
: {}),
|
||||
[RoleTypeEnum.USER]: t('views.role.user'),
|
||||
[RoleTypeEnum.WORKSPACE_MANAGE]: t('views.role.workspaceAdmin'),
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user