Make the first user a superuser
This commit fixes a longstanding bug whereby someone setting up a development instance of StoryBoard would need to modify their user in the relevant table manually, or add their openid to a YAML file and run an extra step, in order to actually do anything useful. Now, the first user to log in to a StoryBoard instance is made into a superuser if no other users exist already for whatever reason. Change-Id: I43b2644b2232c6e342e4d03c8ba16b4fc9e74ddc
This commit is contained in:
parent
459399491c
commit
3e935668d9
@ -150,21 +150,9 @@ available are documented on the :doc:`../webapi/v1` page.
|
||||
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/`.
|
||||
|
||||
|
||||
Make user an admin - current bug
|
||||
================================
|
||||
|
||||
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;
|
||||
The first user who logs in to the StoryBoard instance will be made a
|
||||
superuser with full admin privileges, to allow easy configuration of the
|
||||
development instance.
|
||||
|
||||
|
||||
Optional steps: Seed database with base data
|
||||
|
@ -119,6 +119,10 @@ class SkeletonValidator(RequestValidator):
|
||||
"email": email,
|
||||
"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:
|
||||
user_dict.update({"openid": openid})
|
||||
user = user_api.user_create(user_dict)
|
||||
|
Loading…
x
Reference in New Issue
Block a user