Skip to content

Commit 1bc1e94

Browse files
committed
fix(settings): hide preferences when no personal override is allowed
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 3385308 commit 1bc1e94

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/components/Settings/Settings.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<NcIconSvgWrapper class="account-icon" :path="mdiAccount" :size="20" />
1212
</template>
1313
</NcAppNavigationItem>
14-
<NcAppNavigationItem :name="t('libresign', 'Preferences')"
14+
<NcAppNavigationItem v-if="canManagePreferences"
15+
:name="t('libresign', 'Preferences')"
1516
:to="{name: 'Preferences'}">
1617
<template #icon>
1718
<NcIconSvgWrapper class="preferences-icon" :path="mdiTuneVariant" :size="20" />
@@ -67,6 +68,19 @@ const isAdmin = getCurrentUser()?.isAdmin ?? false
6768
const config = loadState<{ can_manage_group_policies?: boolean }>('libresign', 'config', {})
6869
const policiesStore = usePoliciesStore()
6970
71+
const canManagePreferences = computed(() => {
72+
const signatureFlowPolicy = policiesStore.policies.signature_flow
73+
if (!signatureFlowPolicy || typeof signatureFlowPolicy !== 'object') {
74+
return false
75+
}
76+
77+
const policyState = signatureFlowPolicy as {
78+
canSaveAsUserDefault?: boolean
79+
}
80+
81+
return policyState.canSaveAsUserDefault === true
82+
})
83+
7084
const hasDelegatedEditablePolicies = computed(() => Object.values(policiesStore.policies).some((policy) => {
7185
if (!policy || typeof policy !== 'object') {
7286
return false
@@ -90,6 +104,7 @@ function getAdminRoute() {
90104
91105
defineExpose({
92106
getAdminRoute,
107+
canManagePreferences,
93108
canManagePolicies,
94109
})
95110
</script>

0 commit comments

Comments
 (0)