Skip to content

Commit 7d19aee

Browse files
committed
feat: show user customization toggle in rule editor
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent d3296d1 commit 7d19aee

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

src/views/Settings/PolicyWorkbench/PolicyRuleEditorPanel.vue

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
</div>
4040

4141
<NcCheckboxRadioSwitch
42-
v-if="editorDraft.scope !== 'user' && showAllowOverrideSwitch"
42+
v-if="showAllowOverrideSwitch"
4343
type="switch"
4444
:model-value="editorDraft.allowChildOverride"
4545
:disabled="saveStatus === 'saving'"
4646
@update:modelValue="$emit('update-allow-override', $event)">
4747
<div class="policy-workbench__switch-copy">
48-
<span>{{ t('libresign', 'Allow lower-level overrides') }}</span>
48+
<span>{{ allowOverrideTitle }}</span>
4949
<p>
50-
{{ editorDraft.allowChildOverride ? t('libresign', 'Groups and users can define a more specific value.') : t('libresign', 'Groups and users must inherit this value.') }}
50+
{{ allowOverrideDescription }}
5151
</p>
5252
</div>
5353
</NcCheckboxRadioSwitch>
@@ -76,6 +76,7 @@
7676
</template>
7777

7878
<script setup lang="ts">
79+
import { computed } from 'vue'
7980
import { t } from '@nextcloud/l10n'
8081
import type { EffectivePolicyValue } from '../../../types/index'
8182
@@ -98,7 +99,7 @@ interface TargetOption {
9899
isNoUser?: boolean
99100
}
100101
101-
withDefaults(defineProps<{
102+
const props = withDefaults(defineProps<{
102103
editorDraft: EditorDraft
103104
editorMode: 'create' | 'edit' | null
104105
editorTitle: string
@@ -131,6 +132,26 @@ defineEmits<{
131132
(e: 'save'): void
132133
(e: 'cancel'): void
133134
}>()
135+
136+
const allowOverrideDescription = computed(() => {
137+
if (props.editorDraft.scope === 'user') {
138+
return props.editorDraft.allowChildOverride
139+
? t('libresign', 'This user can customize personal defaults and request-specific values.')
140+
: t('libresign', 'This value is mandatory for this user.')
141+
}
142+
143+
return props.editorDraft.allowChildOverride
144+
? t('libresign', 'Groups and users can define a more specific value.')
145+
: t('libresign', 'Groups and users must inherit this value.')
146+
})
147+
148+
const allowOverrideTitle = computed(() => {
149+
if (props.editorDraft.scope === 'user') {
150+
return t('libresign', 'Allow this user to customize')
151+
}
152+
153+
return t('libresign', 'Allow lower-level customization')
154+
})
134155
</script>
135156

136157
<style scoped lang="scss">

0 commit comments

Comments
 (0)