Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
30a9412f
Commit
30a9412f
authored
Mar 26, 2015
by
Marc Duez
Browse files
server : default.py > add init server command
parent
5b366a4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/web2py/applications/vidjil/controllers/default.py
View file @
30a9412f
...
...
@@ -28,6 +28,58 @@ def index():
def
help
():
return
dict
(
message
=
T
(
'help i
\'
m lost'
))
def
init_db
():
if
db
(
db
.
auth_user
.
id
>
0
).
count
()
==
0
:
id_first_user
=
""
## création du premier user
id_first_user
=
db
.
auth_user
.
insert
(
password
=
db
.
auth_user
.
password
.
validate
(
'1234'
)[
0
],
email
=
'plop@plop.com'
,
first_name
=
'System'
,
last_name
=
'Administrator'
)
## création des groupes de base
id_admin_group
=
db
.
auth_group
.
insert
(
role
=
'admin'
)
id_sa_group
=
db
.
auth_group
.
insert
(
role
=
'user_1'
)
db
.
auth_group
.
insert
(
role
=
"public"
)
db
.
auth_membership
.
insert
(
user_id
=
id_first_user
,
group_id
=
id_admin_group
)
db
.
auth_membership
.
insert
(
user_id
=
id_first_user
,
group_id
=
id_sa_group
)
##création des configs de base
id_config_TRG
=
db
.
config
.
insert
(
name
=
'TRG'
,
command
=
'-c clones -z 100 -R 1 -r 1 -G germline/TRG '
,
info
=
'default trg config'
)
id_config_IGH
=
db
.
config
.
insert
(
name
=
'IGH'
,
command
=
'-c clones -d -z 100 -R 1 -r 1 -G germline/IGH '
,
info
=
'default igh config'
)
## permission
## system admin have admin/read/create rights on all patients, groups and configs
auth
.
add_permission
(
id_admin_group
,
'admin'
,
db
.
patient
,
0
)
auth
.
add_permission
(
id_admin_group
,
'admin'
,
db
.
auth_group
,
0
)
auth
.
add_permission
(
id_admin_group
,
'admin'
,
db
.
config
,
0
)
auth
.
add_permission
(
id_admin_group
,
'read'
,
db
.
patient
,
0
)
auth
.
add_permission
(
id_admin_group
,
'read'
,
db
.
auth_group
,
0
)
auth
.
add_permission
(
id_admin_group
,
'read'
,
db
.
config
,
0
)
auth
.
add_permission
(
id_admin_group
,
'create'
,
db
.
patient
,
0
)
auth
.
add_permission
(
id_admin_group
,
'create'
,
db
.
auth_group
,
0
)
auth
.
add_permission
(
id_admin_group
,
'create'
,
db
.
config
,
0
)
def
init_from_csv
():
if
db
(
db
.
auth_user
.
id
>
0
).
count
()
==
0
:
db
.
import_from_csv_file
(
open
(
'backup.csv'
,
'rb'
),
null
=
''
)
db
.
scheduler_task
.
truncate
()
db
.
scheduler_run
.
truncate
()
#########################################################################
## add a scheduller task to run vidjil on a specific sequence file
# need sequence_file_id, config_id
...
...
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