Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
scc-net
netvs
netvs-core
Commits
9e7a278d
Commit
9e7a278d
authored
Oct 15, 2020
by
gj4210
👽
Browse files
FIX: Check if roles to be assigned already are included
parent
2bbd1a1a
Pipeline
#113340
passed with stages
in 9 minutes and 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/views/netdb/Tokens.vue
View file @
9e7a278d
...
...
@@ -24,7 +24,8 @@
<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"
>
Rolle hinzufügen
<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>
...
...
@@ -103,8 +104,8 @@
<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"
>
Rolle hinzufügen
</b-button>
<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"
>
...
...
@@ -465,7 +466,8 @@ export default {
max_permission_count
:
10
,
new_system
:
''
,
new_role_name
:
''
,
can_add_role
:
false
can_add_role
:
false
,
cant_add_role_reason
:
''
}
},
computed
:
{
...
...
@@ -522,13 +524,18 @@ export default {
})
},
showModalEditAccount
(
account
)
{
this
.
new_system
=
''
this
.
new_role_name
=
''
this
.
new_account
.
description
=
account
.
description
this
.
new_account
.
login_name
=
account
.
login_name
this
.
new_account
.
parent_login_name
=
account
.
parent_login_name
this
.
new_account
.
roles
=
[]
this
.
roles_by_account
[
account
.
login_name
].
forEach
(
role
=>
{
this
.
new_account
.
roles
.
push
(
this
.
assignable_roles_by_fq_name
[
role
.
role_fq_name
][
0
])
})
if
(
this
.
roles_by_account
[
account
.
login_name
])
{
this
.
roles_by_account
[
account
.
login_name
].
forEach
(
role
=>
{
this
.
new_account
.
roles
.
push
(
this
.
assignable_roles_by_fq_name
[
role
.
role_fq_name
][
0
])
})
}
this
.
updateCanAddRole
()
this
.
show_modal_alert
=
false
this
.
$bvModal
.
show
(
'
modal-edit-account
'
)
},
...
...
@@ -604,12 +611,8 @@ export default {
this
.
new_account
.
roles
.
forEach
(
role
=>
{
new_roles
.
push
(
role
.
fq_name
)
})
window
.
console
.
log
(
old_roles
)
window
.
console
.
log
(
new_roles
)
const
roles_to_add
=
new_roles
.
filter
(
x
=>
!
old_roles
.
includes
(
x
))
const
roles_to_remove
=
old_roles
.
filter
(
x
=>
!
new_roles
.
includes
(
x
))
window
.
console
.
log
(
roles_to_add
)
window
.
console
.
log
(
roles_to_remove
)
AccountTokenService
.
update
(
this
.
$store
.
state
.
netdb_axios_config
,
{
description_new
:
this
.
new_account
.
description
,
login_name_old
:
this
.
new_account
.
login_name
,
...
...
@@ -740,15 +743,28 @@ export default {
updateCanAddRole
()
{
if
(
!
this
.
new_system
||
!
this
.
new_role_name
)
{
this
.
can_add_role
=
false
this
.
cant_add_role_reason
=
'
System & Rolle auswählen
'
return
}
let
unique
=
true
let
valid
=
true
const
new_role
=
this
.
new_system
+
'
.
'
+
this
.
new_role_name
this
.
new_account
.
roles
.
forEach
(
role
=>
{
if
(
role
.
system
===
this
.
new_system
&&
role
.
name
===
this
.
new_role_name
)
{
unique
=
false
if
(
role
.
fq_name
===
new_role
)
{
valid
=
false
this
.
cant_add_role_reason
=
'
Rolle schon hinzugefügt
'
}
else
if
(
role
.
contained_roles
.
includes
(
new_role
))
{
valid
=
false
this
.
cant_add_role_reason
=
role
.
fq_name
+
'
enthält
'
+
new_role
}
else
if
(
this
.
assignable_roles_by_fq_name
[
new_role
][
0
].
contained_roles
.
includes
(
role
.
fq_name
))
{
valid
=
false
this
.
cant_add_role_reason
=
new_role
+
'
enthält
'
+
role
.
fq_name
}
})
this
.
can_add_role
=
unique
this
.
can_add_role
=
valid
if
(
valid
)
{
this
.
cant_add_role_reason
=
''
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment