From 97b163bc95ce2586db2aad8484042712a5350548 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Wed, 12 Mar 2014 13:13:06 +0200 Subject: [PATCH] Update manage.py to use permissions --- manage.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/manage.py b/manage.py index bb5f4eeb..f4f2da7e 100755 --- a/manage.py +++ b/manage.py @@ -69,14 +69,18 @@ def drop_tables(): @users_manager.option('email', help="User's email") @users_manager.option('name', help="User's full name") -@users_manager.option('--admin', dest='is_admin', default=False, help="set user as admin") -@users_manager.option('--google', dest='google_auth', default=False, help="user uses Google Auth to login") +@users_manager.option('--admin', dest='is_admin', action="store_true", default=False, help="set user as admin") +@users_manager.option('--google', dest='google_auth', action="store_true", default=False, help="user uses Google Auth to login") def create(email, name, is_admin=False, google_auth=False): print "Creating user (%s, %s)..." % (email, name) print "Admin: %r" % is_admin print "Login with Google Auth: %r\n" % google_auth - user = models.User(email=email, name=name, is_admin=is_admin) + permissions = models.User.DEFAULT_PERMISSIONS + if is_admin: + permissions += ['admin'] + + user = models.User(email=email, name=name, permissions=permissions) if not google_auth: password = prompt_pass("Password") user.hash_password(password)