Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
V
VISPA web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
84
Issues
84
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3pia
VISPA
VISPA web
Commits
aa66479a
Commit
aa66479a
authored
Jan 10, 2019
by
Benjamin Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bin] script for bulk adding users
parent
f8b96db7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
bin/vispa-user-bulkadd
bin/vispa-user-bulkadd
+45
-0
No files found.
bin/vispa-user-bulkadd
0 → 100755
View file @
aa66479a
#!/usr/bin/env python
import
sys
import
os
base
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)))
if
os
.
path
.
isdir
(
base
):
sys
.
path
.
insert
(
0
,
base
)
from
argparse
import
ArgumentParser
import
logging
logging
.
basicConfig
(
level
=
logging
.
INFO
)
parser
=
ArgumentParser
()
parser
.
add_argument
(
'-c'
,
'--configdir'
,
help
=
'Directory containing configuration files.'
)
parser
.
add_argument
(
'-d'
,
'--datadir'
,
help
=
'Directory containing server.'
)
args
=
parser
.
parse_args
()
import
vispa
import
vispa.models
from
sqlalchemy.orm
import
scoped_session
,
sessionmaker
vispa
.
setup_config
(
args
.
configdir
)
session
=
scoped_session
(
sessionmaker
(
autoflush
=
True
,
autocommit
=
False
))
session
.
configure
(
bind
=
vispa
.
models
.
open_database
(
args
.
datadir
))
from
vispa.models.user
import
User
while
True
:
try
:
inp
=
raw_input
()
except
EOFError
,
KeyboardInterrupt
:
break
if
not
inp
:
break
name
,
password
=
unicode
(
inp
).
strip
().
split
(
":"
,
1
)
try
:
User
.
set_password
(
session
,
User
.
register
(
session
,
name
,
"%s@nowhere"
%
name
).
hash
,
password
)
except
vispa
.
AjaxException
as
ex
:
res
=
ex
.
message
else
:
res
=
"ok!"
print
"%15s: %s"
%
(
name
,
res
)
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