1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-26 00:29:43 +02:00

feat: disable admin option when using LDAP auth (#2583)

* fix typo

* add override readonly/disable support for autoform

* made admin permission conditionally disabled
This commit is contained in:
Michael Genson 2023-09-29 18:58:34 -05:00 committed by GitHub
parent 4bd7bda60d
commit 1074cad5dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 10 deletions

View file

@ -34,7 +34,7 @@
<AppButtonCopy v-if="resetUrl" :copy-text="resetUrl"></AppButtonCopy>
</div>
<AutoForm v-model="user" :items="userForm" update-mode />
<AutoForm v-model="user" :items="userForm" update-mode :disabled-fields="disabledFields" />
</v-card-text>
</v-card>
<div class="d-flex pa-2">
@ -45,7 +45,7 @@
</template>
<script lang="ts">
import { defineComponent, useRoute, onMounted, ref } from "@nuxtjs/composition-api";
import { computed, defineComponent, useRoute, onMounted, ref } from "@nuxtjs/composition-api";
import { useAdminApi } from "~/composables/api";
import { useGroups } from "~/composables/use-groups";
import { alert } from "~/composables/use-toast";
@ -71,6 +71,9 @@ export default defineComponent({
const adminApi = useAdminApi();
const user = ref<UserOut | null>(null);
const disabledFields = computed(() => {
return user.value?.authMethod === "LDAP" ? ["admin"] : [];
})
const userError = ref(false);
@ -116,6 +119,7 @@ export default defineComponent({
return {
user,
disabledFields,
userError,
userForm,
refNewUserForm,