Fix HostProfile user properties access.
This commit is contained in:
@@ -10,9 +10,9 @@
|
|||||||
<UserBasicInfo
|
<UserBasicInfo
|
||||||
v-if="ctx"
|
v-if="ctx"
|
||||||
:name="ctx.user.display_name"
|
:name="ctx.user.display_name"
|
||||||
:visits="authStore.userInfo?.visits || 0"
|
:visits="authStore.userInfo.user.visits"
|
||||||
:created-at="authStore.userInfo?.created_at"
|
:created-at="authStore.userInfo.user.created_at"
|
||||||
:last-seen="authStore.userInfo?.last_seen"
|
:last-seen="authStore.userInfo.user.last_seen"
|
||||||
:email="ctx.user.email"
|
:email="ctx.user.email"
|
||||||
:telephone="ctx.user.telephone"
|
:telephone="ctx.user.telephone"
|
||||||
:org-display-name="orgDisplayName"
|
:org-display-name="orgDisplayName"
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
:created-at="authStore.userInfo.user.created_at"
|
:created-at="authStore.userInfo.user.created_at"
|
||||||
:last-seen="authStore.userInfo.user.last_seen"
|
:last-seen="authStore.userInfo.user.last_seen"
|
||||||
:loading="authStore.isLoading"
|
:loading="authStore.isLoading"
|
||||||
:org-display-name="authStore.ctx?.org.display_name"
|
:org-display-name="authStore.userInfo.org.display_name"
|
||||||
:role-name="authStore.ctx?.role.display_name"
|
:role-name="authStore.userInfo.role.display_name"
|
||||||
update-endpoint="/auth/api/user/info"
|
update-endpoint="/auth/api/user/info"
|
||||||
@saved="authStore.loadUserInfo()"
|
@saved="authStore.loadUserInfo()"
|
||||||
@edit="openEditDialog"
|
@edit="openEditDialog"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<CredentialList
|
<CredentialList
|
||||||
ref="credentialList"
|
ref="credentialList"
|
||||||
:credentials="credentials"
|
:credentials="credentials"
|
||||||
:aaguid-info="authStore.userInfo?.aaguid_info || {}"
|
:aaguid-info="authStore.userInfo.aaguid_info"
|
||||||
:loading="authStore.isLoading"
|
:loading="authStore.isLoading"
|
||||||
:hovered-credential-uuid="hoveredCredentialUuid"
|
:hovered-credential-uuid="hoveredCredentialUuid"
|
||||||
:hovered-session-credential-uuid="hoveredSession?.credential"
|
:hovered-session-credential-uuid="hoveredSession?.credential"
|
||||||
@@ -184,11 +184,11 @@ const hasActiveModal = computed(() => showEditDialog.value || showRegLink.value)
|
|||||||
|
|
||||||
watch(showEditDialog, (open) => {
|
watch(showEditDialog, (open) => {
|
||||||
if (!open) return
|
if (!open) return
|
||||||
const user = authStore.userInfo?.user
|
const user = authStore.userInfo.user
|
||||||
editName.value = user?.display_name ?? ''
|
editName.value = user.display_name ?? ''
|
||||||
editEmail.value = user?.email ?? ''
|
editEmail.value = user.email ?? ''
|
||||||
editUsername.value = user?.preferred_username ?? ''
|
editUsername.value = user.preferred_username ?? ''
|
||||||
editTelephone.value = user?.telephone ?? ''
|
editTelephone.value = user.telephone ?? ''
|
||||||
editError.value = ''
|
editError.value = ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ const handleDelete = async (credential) => {
|
|||||||
|
|
||||||
const rpName = computed(() => authStore.settings?.rp_name || 'this service')
|
const rpName = computed(() => authStore.settings?.rp_name || 'this service')
|
||||||
const paskiaVersion = computed(() => authStore.settings?.version || '')
|
const paskiaVersion = computed(() => authStore.settings?.version || '')
|
||||||
const sessions = computed(() => authStore.userInfo?.sessions || {})
|
const sessions = computed(() => authStore.userInfo.sessions)
|
||||||
const currentSessionHost = computed(() => {
|
const currentSessionHost = computed(() => {
|
||||||
const currentSession = Object.values(sessions.value).find(session => session.is_current)
|
const currentSession = Object.values(sessions.value).find(session => session.is_current)
|
||||||
return currentSession?.host || 'this host'
|
return currentSession?.host || 'this host'
|
||||||
@@ -365,12 +365,12 @@ const logoutEverywhere = async () => { await authStore.logoutEverywhere() }
|
|||||||
const logout = async () => { await authStore.logout() }
|
const logout = async () => { await authStore.logout() }
|
||||||
const openEditDialog = () => { showEditDialog.value = true }
|
const openEditDialog = () => { showEditDialog.value = true }
|
||||||
const isAdmin = computed(() => {
|
const isAdmin = computed(() => {
|
||||||
const perms = authStore.ctx?.permissions
|
const perms = Object.values(authStore.userInfo.permissions).map(p => p.scope)
|
||||||
return perms?.includes('auth:admin') || perms?.includes('auth:org:admin')
|
return perms.includes('auth:admin') || perms.includes('auth:org:admin')
|
||||||
})
|
})
|
||||||
const hasMultipleSessions = computed(() => Object.keys(sessions.value).length > 1)
|
const hasMultipleSessions = computed(() => Object.keys(sessions.value).length > 1)
|
||||||
const credentials = computed(() =>
|
const credentials = computed(() =>
|
||||||
Object.entries(authStore.userInfo?.credentials || {}).map(([uuid, c]) => ({ ...c, credential: uuid }))
|
Object.entries(authStore.userInfo.credentials).map(([uuid, c]) => ({ ...c, credential: uuid }))
|
||||||
)
|
)
|
||||||
const useWideLayout = computed(() => {
|
const useWideLayout = computed(() => {
|
||||||
// Check if any single site has more than 8 sessions
|
// Check if any single site has more than 8 sessions
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ from paskia.db import SessionContext
|
|||||||
from paskia.util import hostutil
|
from paskia.util import hostutil
|
||||||
from paskia.util.apistructs import (
|
from paskia.util.apistructs import (
|
||||||
ApiAaguidInfo,
|
ApiAaguidInfo,
|
||||||
|
ApiOrg,
|
||||||
ApiOrgContext,
|
ApiOrgContext,
|
||||||
ApiPermission,
|
ApiPermission,
|
||||||
|
ApiRole,
|
||||||
ApiRoleContext,
|
ApiRoleContext,
|
||||||
ApiSessionContext,
|
ApiSessionContext,
|
||||||
ApiUser,
|
ApiUser,
|
||||||
@@ -64,4 +66,6 @@ async def build_user_info(
|
|||||||
permissions={p.uuid: ApiPermission.from_db(p) for p in ctx.permissions}
|
permissions={p.uuid: ApiPermission.from_db(p) for p in ctx.permissions}
|
||||||
if ctx
|
if ctx
|
||||||
else {},
|
else {},
|
||||||
|
org=ApiOrg.from_db(ctx.org) if ctx else None,
|
||||||
|
role=ApiRole.from_db(ctx.role) if ctx else None,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user