Commit 3bec7d1a authored by gj4210's avatar gj4210 👽
Browse files

FIX: Edit accounts with 0 roles

parent 9e7a278d
Pipeline #113341 passed with stages
in 9 minutes and 51 seconds
......@@ -11,7 +11,8 @@
placeholder="Beschreibung eingeben"
/>
</b-form-group>
<template v-if="roles_by_account != null && roles_by_account[$store.state.user.login_name] != null && assignable_role_name_options_by_system != null">
<template
v-if="roles_by_account != null && roles_by_account[$store.state.user.login_name] != null && assignable_role_name_options_by_system != null">
<b-form-group label="Rollen">
<b-form-radio v-model="new_account.do_copy_roles" :value="true">von Parent-Account übernehmen
</b-form-radio>
......@@ -24,8 +25,9 @@
<b-form-select @change="updateCanAddRole" v-model="new_role_name"
:options="assignable_role_name_options_by_system[new_system]"/>
<b-input-group-append>
<b-button variant="success" :disabled="!can_add_role" @click="addRole"><template v-if="cant_add_role_reason === ''">Rolle hinzufügen</template>
<template v-else class="text-danger">{{cant_add_role_reason}}</template>
<b-button variant="success" :disabled="!can_add_role" @click="addRole">
<template v-if="cant_add_role_reason === ''">Rolle hinzufügen</template>
<template v-else class="text-danger">{{ cant_add_role_reason }}</template>
</b-button>
</b-input-group-append>
</b-input-group>
......@@ -96,44 +98,47 @@
placeholder="Beschreibung eingeben"
/>
</b-form-group>
<template v-if="roles_by_account != null && roles_by_account[$store.state.user.login_name] != null && assignable_role_name_options_by_system != null">
<template
v-if="roles_by_account != null && roles_by_account[$store.state.user.login_name] != null && assignable_role_name_options_by_system != null">
<b-form-group label="Rollen">
<b-input-group>
<b-form-select @change="updateCanAddRole" v-model="new_system"
:options="assignable_system_options"/>
<b-form-select @change="updateCanAddRole" v-model="new_role_name"
:options="assignable_role_name_options_by_system[new_system]"/>
<b-input-group-append>
<b-button variant="success" :disabled="!can_add_role" @click="addRole"><template v-if="cant_add_role_reason === ''">Rolle hinzufügen</template>
<template v-else class="text-danger">{{cant_add_role_reason}}</template></b-button>
</b-input-group-append>
</b-input-group>
<h5 class="my-1">
<template
v-for="role in new_account.roles">
<b-button
:key="'role-badge-' + role.mgr_login_name + '-' + role.fq_name"
:id="'create-account-role-badge-' + role.fq_name"
:style="{background: role.fq_name.toHSL({lit: [30, 40]}), border: 'none'}"
class="mr-1 mb-1 badge">
<div class="d-flex align-items-center">
{{ role.system.toUpperCase() }}<br>{{ role.name }}
<span @click="removeRole(role)" class="p-2">
<b-input-group>
<b-form-select @change="updateCanAddRole" v-model="new_system"
:options="assignable_system_options"/>
<b-form-select @change="updateCanAddRole" v-model="new_role_name"
:options="assignable_role_name_options_by_system[new_system]"/>
<b-input-group-append>
<b-button variant="success" :disabled="!can_add_role" @click="addRole">
<template v-if="cant_add_role_reason === ''">Rolle hinzufügen</template>
<template v-else class="text-danger">{{ cant_add_role_reason }}</template>
</b-button>
</b-input-group-append>
</b-input-group>
<h5 class="my-1">
<template
v-for="role in new_account.roles">
<b-button
:key="'role-badge-' + role.mgr_login_name + '-' + role.fq_name"
:id="'create-account-role-badge-' + role.fq_name"
:style="{background: role.fq_name.toHSL({lit: [30, 40]}), border: 'none'}"
class="mr-1 mb-1 badge">
<div class="d-flex align-items-center">
{{ role.system.toUpperCase() }}<br>{{ role.name }}
<span @click="removeRole(role)" class="p-2">
<font-awesome-icon style="opacity: 0.7" :icon="['fas','times']"/>
</span>
</div>
</b-button>
<b-popover
:key="'role-badge-tooltip' + role.mgr_login_name + '-' + role.fq_name"
:target="'create-account-role-badge-' + role.fq_name"
triggers="focus" custom-class="popover-wide"
placement="bottom">
<b-table :fields="permission_list_fields"
:items="role.contained_permissions"
sticky-header/>
</b-popover>
</template>
</h5>
</div>
</b-button>
<b-popover
:key="'role-badge-tooltip' + role.mgr_login_name + '-' + role.fq_name"
:target="'create-account-role-badge-' + role.fq_name"
triggers="focus" custom-class="popover-wide"
placement="bottom">
<b-table :fields="permission_list_fields"
:items="role.contained_permissions"
sticky-header/>
</b-popover>
</template>
</h5>
</b-form-group>
</template>
</b-form>
......@@ -604,9 +609,11 @@ export default {
editAccount() {
this.waiting = true
const old_roles = []
this.roles_by_account[this.new_account.login_name].forEach(role => {
old_roles.push(role.role_fq_name)
})
if (this.roles_by_account[this.new_account.login_name]) {
this.roles_by_account[this.new_account.login_name].forEach(role => {
old_roles.push(role.role_fq_name)
})
}
const new_roles = []
this.new_account.roles.forEach(role => {
new_roles.push(role.fq_name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment