From cd06bceb6c95bb6a0f61b3b500ffeef66cefa3c6 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 20 Apr 2023 03:20:41 +0200 Subject: [PATCH 1/9] Show read-only user-attributes as locked --- .../src/components/OcSelect/OcSelect.vue | 1 + .../components/Users/SideBar/EditPanel.vue | 19 +++++++-- .../web-pkg/src/components/QuotaSelect.vue | 42 +------------------ .../src/components/Spaces/QuotaModal.vue | 2 +- .../composables/capability/useCapability.ts | 6 +++ 5 files changed, 26 insertions(+), 44 deletions(-) diff --git a/packages/design-system/src/components/OcSelect/OcSelect.vue b/packages/design-system/src/components/OcSelect/OcSelect.vue index 90363aa3cbb..2fedaba2ce8 100644 --- a/packages/design-system/src/components/OcSelect/OcSelect.vue +++ b/packages/design-system/src/components/OcSelect/OcSelect.vue @@ -288,6 +288,7 @@ export default defineComponent({ ) }, messageText() { + console.log(this.descriptionMessage) if (this.errorMessage) { return this.errorMessage } diff --git a/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue b/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue index b49f75cdb25..bc106c3ade4 100644 --- a/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue +++ b/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue @@ -10,6 +10,7 @@ :label="$gettext('User name')" :error-message="formData.userName.errorMessage" :fix-message-line="true" + :read-only="isInputFieldReadOnly('user.onPremisesSamAccountName')" @update:model-value="validateUserName" />
@@ -49,6 +53,7 @@ option-label="displayName" :options="translatedRoleOptions" :clearable="false" + :read-only="isInputFieldReadOnly('user.appRoleAssignments')" @update:model-value="onUpdateRole" />
@@ -61,6 +66,7 @@ :label="$gettext('Login')" :options="loginOptions" :clearable="false" + :read-only="isInputFieldReadOnly('user.accountEnabled')" @update:model-value="onUpdateLogin" /> @@ -71,15 +77,16 @@ :key="'quota-select-' + user.id" :disabled="isQuotaInputDisabled" class="oc-mb-s" - :title="$gettext('Personal quota')" + :label="$gettext('Personal quota')" :total-quota="editUser.drive?.quota?.total || 0" :max-quota="maxQuota" :fix-message-line="true" :description-message=" - isQuotaInputDisabled + isQuotaInputDisabled && !isInputFieldReadOnly('drive.quota') ? $gettext('To set an individual quota, the user needs to have logged in once.') : '' " + :read-only="isInputFieldReadOnly('drive.quota')" @selected-option-change="changeSelectedQuotaOption" /> !selectedGroups.some((s) => s.id === g.id) && !g.groupTypes?.includes('ReadOnly') ) }) + const readOnlyUserAttributes = useCapabilityReadOnlyUserAttributes() const isLoginInputDisabled = computed(() => currentUser.uuid === (props.user as User).id) + const isInputFieldReadOnly = (key) => { + return readOnlyUserAttributes.value.includes(key) + } + return { maxQuota: useCapabilitySpacesMaxQuota(), + isInputFieldReadOnly, isLoginInputDisabled, editUser, formData, diff --git a/packages/web-pkg/src/components/QuotaSelect.vue b/packages/web-pkg/src/components/QuotaSelect.vue index c35b10b3874..cb53be59722 100644 --- a/packages/web-pkg/src/components/QuotaSelect.vue +++ b/packages/web-pkg/src/components/QuotaSelect.vue @@ -4,21 +4,17 @@ ref="select" :model-value="selectedOption" :selectable="optionSelectable" - :disabled="disabled" taggable push-tags :clearable="false" :options="options" :create-option="createOption" option-label="displayValue" - :label="title" - :fix-message-line="fixMessageLine" - :error-message="errorMessage" - :warning-message="warningMessage" - :description-message="descriptionMessage" + v-bind="$attrs" @update:model-value="onUpdate" >