Mercurial > repos > yating-l > jbrowsearchivecreator
comparison util/subtools.py @ 31:127037c49bc8 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
| author | yating-l |
|---|---|
| date | Mon, 16 Oct 2017 18:03:58 -0400 |
| parents | 31a41ce128cc |
| children | 7b955a58d8f2 |
comparison
equal
deleted
inserted
replaced
| 30:2191bd0798a9 | 31:127037c49bc8 |
|---|---|
| 340 def arrow_create_user(user_email, firstname, lastname, password, admin=False): | 340 def arrow_create_user(user_email, firstname, lastname, password, admin=False): |
| 341 """ Create a new user of Apollo, the default user_role is "user" """ | 341 """ Create a new user of Apollo, the default user_role is "user" """ |
| 342 array_call = ['arrow', 'users', 'create_user', user_email, firstname, lastname, password] | 342 array_call = ['arrow', 'users', 'create_user', user_email, firstname, lastname, password] |
| 343 if admin: | 343 if admin: |
| 344 array_call += ['--role', 'admin'] | 344 array_call += ['--role', 'admin'] |
| 345 logging.debug("%s", array_call) | |
| 346 print array_call | |
| 345 p = subprocess.check_output(array_call) | 347 p = subprocess.check_output(array_call) |
| 348 print ("p = %s", p) | |
| 346 return p | 349 return p |
| 347 | 350 |
| 348 def arrow_update_organism_permissions(user_id, organism, **user_permissions): | 351 def arrow_update_organism_permissions(user_id, organism, **user_permissions): |
| 349 array_call = ['arrow', 'users', 'update_organism_permissions', str(user_id), str(organism)] | 352 array_call = ['arrow', 'users', 'update_organism_permissions', str(user_id), str(organism)] |
| 350 admin = user_permissions.get("admin", False) | 353 admin = user_permissions.get("admin", False) |
| 362 p = subprocess.check_output(array_call) | 365 p = subprocess.check_output(array_call) |
| 363 return p | 366 return p |
| 364 | 367 |
| 365 def arrow_get_users(user_email): | 368 def arrow_get_users(user_email): |
| 366 array_call = ['arrow', 'users', 'get_users'] | 369 array_call = ['arrow', 'users', 'get_users'] |
| 370 logging.debug("%s", array_call) | |
| 371 print array_call | |
| 367 p = subprocess.check_output(array_call) | 372 p = subprocess.check_output(array_call) |
| 368 all_users = json.loads(p) | 373 all_users = json.loads(p) |
| 369 for d in all_users: | 374 for d in all_users: |
| 370 if d['username'] == user_email: | 375 if d['username'] == user_email: |
| 371 return d['userId'] | 376 return d['userId'] |
| 372 logging.error("Cannot find user %s", user_email) | 377 logging.error("Cannot find user %s", user_email) |
| 378 |
