Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/types-builder/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ const emit = defineEmits(emits)
for (const locale of vjsfLocales) {
const schemaVjsfOpts = { ...schema['x-vjsf'] }
delete schemaVjsfOpts.compName
console.log(` compiledLayout ${locale} options: ${JSON.stringify(schemaVjsfOpts)}`)
const otherSchemas = { ...schemas }
for (const [key, otherSchema] of Object.entries(schemas)) {
if (key === schema.$id) continue
Expand All @@ -375,7 +376,6 @@ const emit = defineEmits(emits)
fullOptions.components[componentInfo.name] = componentInfo
}

console.log(` compiledLayout ${locale} options: ${JSON.stringify(schemaVjsfOpts)}`)
const compiledLayout = compileLayout(schema, fullOptions)
let compiledLayoutCode = await serializeCompiledLayout(compiledLayout)
// The serialized code declares `const compiledLayout = {...}`.
Expand Down
24 changes: 20 additions & 4 deletions packages/vuetify/layout-fetch-error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const { error, backTo = '/', backLabel } = defineProps<{
}>()

const { t } = useI18n({ useScope: 'local' })
const { switchOrganization, user } = useSession()
const { switchOrganization, user, account } = useSession()

const statusCode = computed(() => error?.statusCode ?? error?.status ?? 500)

Expand Down Expand Up @@ -99,9 +99,25 @@ const switchOrg = computed(() => {
try { owner = JSON.parse(rawOwner) } catch { return null }
if (!owner || owner.type !== 'organization' || !owner.id) return null

return user.value.organizations?.find(o =>
o.id === owner!.id && (o.department ?? undefined) === (owner!.department ?? undefined)
) ?? null
const orgs = user.value.organizations ?? []
const ownerDept = owner.department ?? undefined
const isCurrentAccount = (o: { id: string, department?: string }) =>
account.value?.type === 'organization' &&
account.value.id === o.id &&
(account.value.department ?? undefined) === (o.department ?? undefined)

// Prefer a membership matching the resource's department exactly...
const exact = orgs.find(o =>
o.id === owner!.id && (o.department ?? undefined) === ownerDept && !isCurrentAccount(o)
)
if (exact) return exact
// ...otherwise fall back to a membership at the organization root: in
// simple-directory's authz model, root access generally grants visibility
// over department-scoped resources.
if (ownerDept) {
return orgs.find(o => o.id === owner!.id && !o.department && !isCurrentAccount(o)) ?? null
}
return null
})

const doSwitch = () => {
Expand Down
6 changes: 2 additions & 4 deletions packages/vuetify/personal-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ fr:
openPersonalMenu: Ouvrez le menu personnel
personalAccount: Compte personnel
switchAccount: Changer de compte
adminMode: mode admin
adminMode: Mode admin
backToAdmin: Revenir à ma session administrateur
darkMode: mode nuit
plannedDeletion: La suppression de l'utilisateur {name} et toutes ses informations est programmée le {plannedDeletion}.
cancelDeletion: Annuler la suppression de l'utilisateur
en:
Expand All @@ -193,9 +192,8 @@ en:
openPersonalMenu: Open personal menu
personalAccount: Personal account
switchAccount: Switch account
adminMode: admin mode
adminMode: Admin mode
backToAdmin: Return to administrator session
darkMode: night mode
plannedDeletion: The deletion of the user {name} and all its data is planned on the {plannedDeletion}.
cancelDeletion: Cancel the deletion of the user
</i18n>
Expand Down