Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kontr 2.0
Portal API Backend
Commits
33e6d2a6
Verified
Commit
33e6d2a6
authored
Oct 13, 2018
by
Peter Stanko
Browse files
Adding user even if the user exists when importing
parent
f730c9bc
Pipeline
#17057
passed with stage
in 8 minutes and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
management/data/__init__.py
View file @
33e6d2a6
...
...
@@ -193,8 +193,10 @@ class DataManagement(object):
users
=
self
.
_parse_csv_users
(
file
)
created_users
=
[]
for
user
in
users
:
if
self
.
rest
.
find
.
user
(
user
[
'username'
],
throws
=
False
):
found_user
=
self
.
rest
.
find
.
user
(
user
[
'username'
],
throws
=
False
)
if
found_user
:
log
.
debug
(
f
"[IMPORT] skipping already existing user
{
user
[
'username'
]
}
:
{
user
}
"
)
created_users
.
append
(
found_user
)
continue
log
.
debug
(
f
"[IMPORT] Adding user
{
user
[
'username'
]
}
:
{
user
}
"
)
created
=
self
.
rest
.
users
.
create
(
**
user
,
admin
=
False
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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