Merge "Make the first user a superuser"

This commit is contained in:
Zuul 2019-05-02 17:15:41 +00:00 committed by Gerrit Code Review
commit 6aba5d7f5c
2 changed files with 7 additions and 15 deletions

View File

@ -455,21 +455,9 @@ on the :doc:`../webapi/v1` page.
The webclient server also forwards ``/api`` to the API server, so it is also The webclient server also forwards ``/api`` to the API server, so it is also
possible to use the API by sending requests to http://localhost:9000/api/. possible to use the API by sending requests to http://localhost:9000/api/.
The first user who logs in to the StoryBoard instance will be made a
Make user an admin - current bug superuser with full admin privileges, to allow easy configuration of the
================================ development instance.
Once logged into the webclient, this user needs to be set to admin
manually due to a current bug in Storyboard.
1. Ensure that you have logged into your Storyboard instance at least once so
that your user details are stored in the database.
2. Run mysql and change your user to superadmin::
mysql -u root -p
use storyboard;
update users set is_superuser=1;
Optional steps: Seed database with base data Optional steps: Seed database with base data

View File

@ -119,6 +119,10 @@ class SkeletonValidator(RequestValidator):
"email": email, "email": email,
"last_login": last_login} "last_login": last_login}
# Make the first registered user an admin
if user_api.user_get_count() == 0:
user_dict.update({"is_superuser": True})
if not user: if not user:
user_dict.update({"openid": openid}) user_dict.update({"openid": openid})
user = user_api.user_create(user_dict) user = user_api.user_create(user_dict)