diff --git a/doc/source/install/development.rst b/doc/source/install/development.rst index 3144d2cb..1e7a9296 100644 --- a/doc/source/install/development.rst +++ b/doc/source/install/development.rst @@ -455,21 +455,9 @@ 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 diff --git a/storyboard/api/auth/oauth_validator.py b/storyboard/api/auth/oauth_validator.py index 9cf43da5..4056b5d7 100644 --- a/storyboard/api/auth/oauth_validator.py +++ b/storyboard/api/auth/oauth_validator.py @@ -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)