From 01f55d2fd3ea0e9620bb631dd91e475444393099 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Tue, 9 Jan 2018 10:41:42 +0100 Subject: Permit to create staff/superuser users This patch add two user options staff and superuser. This will permit to create users with thoses flag in LAVA. In the process remove the hardcoded admin user from Dockerfile and move it in tokens.yaml --- lavalab-gen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lavalab-gen.py') diff --git a/lavalab-gen.py b/lavalab-gen.py index 64a4b0b..e5f5db0 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -120,7 +120,16 @@ def main(args): ftok.write("TOKEN=" + token + "\n") if user.has_key("password"): password = user["password"] - ftok.write("PASSWORD=" + password) + ftok.write("PASSWORD=" + password + "\n") + # libyaml convert yes/no to true/false... + if user.has_key("staff"): + value = user["staff"] + if value is True: + ftok.write("STAFF=1\n") + if user.has_key("superuser"): + value = user["superuser"] + if value is True: + ftok.write("SUPERUSER=1\n") ftok.close() if section_name == "callback_tokens": for token in section: -- cgit 1.2.3-korg