Commit 132932c8 authored by janis.streib's avatar janis.streib 🦉
Browse files

UPD: subgroup management

parent 00d54c05
Pipeline #112469 passed with stages
in 8 minutes and 43 seconds
<template>
<b-card no-body :header-bg-variant="group.is_sub_group?'transparent':'light'" :key="'card-group-' + group.name" :class="group.is_sub_group?'mb-4' : 'mb-4 shadow'" v-if="bcds2grp != null" >
<template v-slot:header>
<b-row>
<b-col>
<h4>
{{ group.name }}
</h4>
<p class="text-muted">Gruppenname</p>
</b-col>
</b-row>
</template>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-bcds'">
BCDs (Adressraum)<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-bcds'">
<b-table :items="bcds2grp[group.name]" :fields="bcd_list_fields">
<template v-slot:cell(bcd_name)="data">
<b-link :to="'/dnsvs/bcds/'+data.item.bcd_name">{{ data.item.bcd_name }}</b-link>
</template>
<template v-slot:cell(bcd_description)>
{{ bcds2grp[group.name].description }}
</template>
<template v-slot:head(actions)>
<b-button block variant="outline-success"
:id="'button-assign-bcd-' + group.name" @click="createBcd2Group(group.name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-assign-bcd-' + group.name" triggers="hover"
variant="success" placement="left">
Neue BCD zuordnen
</b-tooltip>
</template>
<template v-slot:cell(actions)="data">
<b-button-group class="d-flex">
<b-button @click="deleteBcdItem(data.item)" variant="outline-danger"
:id="'button-unassign-bcd-' + data.item.bcd_name">
<font-awesome-icon :icon="['fas', 'unlink']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-unassign-bcd-' + data.item.bcd_name" triggers="hover"
variant="danger" placement="left">
Zuweisung aufheben
</b-tooltip>
</b-button-group>
</template>
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-domains'">
Domains (Namensraum)<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-domains'">
<b-table :items="fqdn2grp[group.name]" :fields="fqdn_list_fields">
<template v-slot:head(actions)>
<b-button block variant="outline-success"
:id="'button-assign-fqdn-' + group.name" @click="createFqdn2Group(group.name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-assign-fqdn-' + group.name" triggers="hover"
variant="success" placement="left">
Neue Domain zuordnen
</b-tooltip>
</template>
<template v-slot:cell(fqdn_value)="data">
{{ data.item.fqdn_value }}
<b-badge v-if="data.item.is_dhcp_domain">DHCP-Domain</b-badge>
</template>
<template v-slot:cell(actions)="data">
<b-button-group class="d-flex">
<b-button @click="editFqdn2Group(data.item)" variant="outline-primary"
:id="'button-edit-fqdn-' + data.item.fqdn_value">
<font-awesome-icon :icon="['far', 'edit']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-edit-fqdn-' + data.item.fqdn_value" triggers="hover"
variant="primary" placement="bottom">
Zuweisung editieren
</b-tooltip>
<b-button @click="deleteFqdnItem(data.item)" variant="outline-danger"
:id="'button-unassign-fqdn-' + data.item.fqdn_value">
<font-awesome-icon :icon="['fas', 'unlink']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-unassign-fqdn-' + data.item.fqdn_value" triggers="hover"
variant="danger" placement="bottom">
Zuweisung aufheben
</b-tooltip>
</b-button-group>
</template>
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-members'">
Gruppenmitglieder<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-members'">
<b-table :items="mgrs2grp[group.name]" :fields="mgr_list_fields">
<template v-slot:cell(first_name)="data">
{{ mgrs[data.item.mgr_login_name].first_name }}
</template>
<template v-slot:cell(last_name)="data">
{{ mgrs[data.item.mgr_login_name].last_name }}
</template>
<template v-slot:cell(email)="data">
<b-link :href="'mailto:'+mgrs[data.item.mgr_login_name].email">
{{ mgrs[data.item.mgr_login_name].email }}
</b-link>
</template>
<template v-slot:head(actions)>
<b-button block variant="outline-success"
:id="'button-assign-mgr-' + group.name" @click="createMgr2Group(group.name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-assign-mgr-' + group.name" triggers="hover"
variant="success" placement="left">
Neuen Account zuordnen
</b-tooltip>
</template>
<template v-slot:cell(actions)="data">
<b-button-group class="d-flex">
<b-button @click="deleteMgrItem(data.item)" variant="outline-danger"
:id="'button-unassign-mgr-' + data.item.mgr_login_name">
<font-awesome-icon :icon="['fas', 'unlink']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-unassign-mgr-' + data.item.mgr_login_name" triggers="hover"
variant="danger" placement="left">
Zuweisung aufheben
</b-tooltip>
</b-button-group>
</template>
</b-table>
</b-collapse>
<template v-if="!group.is_sub_group">
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-subgroups'">
Untergruppen<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-subgroups'">
<b-container fluid style="margin-top: 20px">
<b-button style="margin-bottom: 20px" block variant="outline-success"
:id="'button-create-subgroup-' + group.name" @click="createSubgroup(group.name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-create-subgroup-' + group.name" triggers="hover"
variant="success" placement="bottom">
Neue Untergruppe anlegen
</b-tooltip>
<GroupCard v-for="sub in subgroups" v-bind:key="sub.name"
:group="sub"
:groups="groups"
:edit-fqdn2-group="editFqdn2Group"
:create-mgr2-group="createMgr2Group"
:mgrs2grp="mgrs2grp"
:fqdn2grp="fqdn2grp"
:bcds2grp="bcds2grp"
:create-fqdn2-group="createFqdn2Group"
:mgrs="mgrs"
:delete-fqdn-item="deleteFqdnItem"
:delete-bcd-item="deleteBcdItem"
:delete-mgr-item="deleteMgrItem"
:create-bcd2-group="createBcd2Group"
></GroupCard>
</b-container>
</b-collapse>
</template>
</b-card>
</template>
<script>
export default {
name: 'GroupCard',
components: {
GroupCard: () => import('./GroupCard.vue')
},
data() {
return {
bcd_list_fields: [
{
key: 'bcd_name',
label: 'BCD',
sortable: true
},
{
key: 'bcd_description',
label: 'Beschreibung',
sortable: false
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
],
fqdn_list_fields: [
{
key: 'fqdn_value',
label: 'FQDN',
sortable: true
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
],
subgroup_list_fields: [
{
key: 'name',
label: 'Name',
sortable: true
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
],
mgr_list_fields: [
{
key: 'mgr_login_name',
label: 'Login Name',
sortable: false
},
{
key: 'first_name',
label: 'Vorname',
sortable: false
},
{
key: 'last_name',
label: 'Nachname',
sortable: false
},
{
key: 'email',
label: 'E-Mail',
sortable: false
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
]
}
},
props: {
group: {
type: Object,
required: true
},
groups: {
type: Array,
required: true
},
mgrs: {
type: Object,
required: true
},
bcds2grp: {
type: Object,
required: true
},
mgrs2grp: {
type: Object,
required: true
},
fqdn2grp: {
type: Object,
required: true
},
subgroups: {
type: Array,
required: false
},
deleteMgrItem: {
type: Function,
required: true
},
deleteFqdnItem: {
type: Function,
required: true
},
deleteBcdItem: {
type: Function,
required: true
},
createSubgroup: {
type: Function,
required: false
},
createMgr2Group: {
type: Function,
required: true
},
createBcd2Group: {
type: Function,
required: true
},
createFqdn2Group: {
type: Function,
required: true
},
editFqdn2Group: {
type: Function,
required: true
}
}
}
</script>
<style scoped>
</style>
......@@ -42,7 +42,7 @@ export default {
},
remove_empty_data (params_list, data) {
return Object.keys(data).reduce(function (filtered, key) {
if (!(params_list[key].json_data_type === 'number' && data[key] === '')) filtered[key] = data[key]
if (!(data[key] === '')) filtered[key] = data[key]
return filtered
}, {})
},
......
......@@ -3,93 +3,34 @@
<h1>Gruppen</h1>
<Loading :data="[groups]">
<template v-for="group in groups">
<b-card no-body :key="'card-group-' + group.name" class="mb-4 shadow">
<template v-slot:header>
<b-row>
<b-col>
<h4>
{{ group.name }}
</h4>
<p class="text-muted">Gruppenname</p>
</b-col>
</b-row>
</template>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-bcds'">
BCDs (Adressraum)<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-bcds'">
<b-table :items="bcds2grp[group.name]" :fields="bcd_list_fields">
<template v-slot:cell(bcd_name)="data">
<b-link :to="'/dnsvs/bcds/'+data.item.bcd_name">{{ data.item.bcd_name }}</b-link>
</template>
<template v-slot:cell(bcd_description)="data">
{{ bcds[data.item.bcd_name].description }}
</template>
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-domains'">
Domains (Namensraum)<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-domains'">
<b-table :items="fqdn2grp[group.name]">
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-members'">
Gruppenmitglieder<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-members'">
<b-table :items="mgrs2grp[group.name]" :fields="mgr_list_fields">
<template v-slot:cell(first_name)="data">
{{ mgrs[data.item.mgr_login_name].first_name }}
</template>
<template v-slot:cell(last_name)="data">
{{ mgrs[data.item.mgr_login_name].last_name }}
</template>
<template v-slot:cell(email)="data">
<b-link :href="'mailto:'+mgrs[data.item.mgr_login_name].email">
{{ mgrs[data.item.mgr_login_name].email }}
</b-link>
</template>
<template v-slot:head(actions)>
<b-button block variant="outline-success"
:id="'button-assign-mgr-' + group.name" @click="createMgr2Group(group.name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-assign-mgr-' + group.name" triggers="hover"
variant="success" placement="left">
Neuen Account zuordnen
</b-tooltip>
</template>
<template v-slot:cell(actions)="data">
<b-button @click="deleteItem(data.item)" variant="danger"
:id="'button-unassign-mgr-' + data.item.mgr_login_name">
<font-awesome-icon :icon="['fas', 'unlink']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-unassign-mgr-' + data.item.mgr_login_name" triggers="hover"
variant="danger" placement="left">
Zuweisung aufheben
</b-tooltip>
</template>
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-subgroups'">
Untergruppen<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-subgroups'">
<b-table :items="groups_by_parent[group.name]">
</b-table>
</b-collapse>
</b-card>
<GroupCard
v-bind:key="group.name"
:mgrs="mgrs"
:group="group"
:groups="groups"
:create-bcd2-group="createBCD2Group"
:create-fqdn2-group="createFQDN2Group"
:create-mgr2-group="createMgr2Group"
:create-subgroup="createSubgroup"
:delete-bcd-item="deleteBCDItem"
:delete-mgr-item="deleteMgrItem"
:delete-fqdn-item="deleteFQDNItem"
:edit-fqdn2-group="editFQDN2Group"
:subgroups="groups_by_parent[group.name]"
:fqdn2grp="fqdn2grp"
:bcds2grp="bcds2grp"
:mgrs2grp="mgrs2grp"
>
</GroupCard>
</template>
</Loading>
<DBEditor modal_id="assign_user_to_group" object_function="create" object_fq_name="cntl.mgr2group"
<DBEditor v-if="db_editor_object_fq_name" modal_id="assign_to_group" :object_function="db_editor_function"
:object_fq_name="db_editor_object_fq_name"
:presets="db_editor_presets"
:non_optionals_order="['group_name', 'mgr_login_name']"
object_title="Konto-zu-Gruppen-Zuordnung"></DBEditor>
:non_optionals_order="['group_name', 'parent_name', 'do_copy_assignments', 'mgr_login_name', 'bcd_name', 'fqdn_value']"
:object_title="db_editor_object_fq_name[db_editor_object_fq_name]"
:old_data="db_editor_old_data">
</DBEditor>
</div>
</template>
......@@ -99,65 +40,32 @@ import Loading from '@/components/Loading'
import apiutil from '@/util/apiutil'
import transactionutil from '@/util/transactionutil'
import Mgr2GroupService from '@/api-services.gen/cntl.mgr2group'
import BCD2GroupService from '@/api-services.gen/nd.bcd2group'
import FQDN2GroupService from '@/api-services.gen/dns.fqdn2group'
import DBEditor from '@/components/DBEditor'
import GroupCard from '@/components/GroupCard'
export default {
name: 'Groups',
components: {DBEditor, Loading},
components: {GroupCard, DBEditor, Loading},
data() {
return {
mgrs: null,
db_editor_presets: {},
db_editor_object_fq_name: null,
db_editor_function: 'create',
db_editor_old_data: {},
db_editor_object_title: {
'cntl.mgr2group': 'Konto-zu-Gruppen-Zuordnung',
'nd.bcd2group': 'BCD-zu-Gruppen-Zuordnung',
'dns.fqdn2group': 'Domain-zu-Gruppen-Zuordnung'
},
mgrs2grp: null,
bcds2grp: null,
fqdn2grp: null,
groups: null,
ous: null,
groups_by_parent: null,
bcd_list_fields: [
{
key: 'bcd_name',
label: 'BCD',
sortable: true
},
{
key: 'bcd_description',
label: 'Beschreibung',
sortable: false
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
],
mgr_list_fields: [
{
key: 'mgr_login_name',
label: 'Login Name',
sortable: false
},
{
key: 'first_name',
label: 'Vorname',
sortable: false
},
{
key: 'last_name',
label: 'Nachname',
sortable: false
},
{
key: 'email',
label: 'E-Mail',
sortable: false
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
]
groups_by_parent: null
}
},
methods: {
......@@ -173,7 +81,7 @@ export default {
this.groups_by_parent = apiutil.dict_of_lists_by_value_of_array(subgroups, 'parent_name')
this.bcds = apiutil.dict_by_value_of_array(res[5], 'name')
},
deleteItem: function (item) {
deleteMgrItem(item) {
const ta = transactionutil.generateDeleteElement('cntl.mgr2group', Mgr2GroupService.deleteParamsList(), item, item.mgr_login_name + ' aus Gruppe ' + item.group_name)
this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta)
......@@ -181,9 +89,56 @@ export default {
this.$store.state.show_sidebar = true
}
},
deleteBCDItem(item) {
const ta = transactionutil.generateDeleteElement('nd.bcd2group', BCD2GroupService.deleteParamsList(), item, item.bcd_name + ' aus Gruppe ' + item.group_name)
this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta)
if (!this.isMobile() && !this.$store.state.show_sidebar) {
this.$store.state.show_sidebar = true
}
},
deleteFQDNItem(item) {
const ta = transactionutil.generateDeleteElement('dns.fqdn2group', FQDN2GroupService.deleteParamsList(), item, item.fqdn_value + ' aus Gruppe ' + item.group_name)
this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta)
if (!this.isMobile() && !this.$store.state.show_sidebar) {
this.$store.state.show_sidebar = true
}
},
createSubgroup(parent_name) {
this.db_editor_function = 'create'
this.db_editor_old_data = {}
this.db_editor_presets = {parent_name: parent_name}
this.db_editor_object_fq_name = 'cntl.group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
},
createMgr2Group(group_name) {
this.db_editor_function = 'create'
this.db_editor_old_data = {}
this.db_editor_presets = {group_name: group_name}
this.$root.$emit('bv::show::modal', 'assign_user_to_group')
this.db_editor_object_fq_name = 'cntl.mgr2group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
},
createBCD2Group(group_name) {
this.db_editor_function = 'create'
this.db_editor_old_data = {}
this.db_editor_presets = {group_name: group_name}
this.db_editor_object_fq_name = 'nd.bcd2group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
},
createFQDN2Group(group_name) {
this.db_editor_function = 'create'
this.db_editor_old_data = {}
this.db_editor_presets = {group_name: group_name}
this.db_editor_object_fq_name = 'dns.fqdn2group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
},
editFQDN2Group(item) {
this.db_editor_function = 'bulk_update'
this.db_editor_presets = {}
this.db_editor_old_data = item
this.db_editor_object_fq_name = 'dns.fqdn2group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
}
},
async mounted() {
......
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