mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 09:05:17 +00:00
Update manage.py to use permissions
This commit is contained in:
parent
13f3a5e172
commit
97b163bc95
10
manage.py
10
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)
|
||||
|
Loading…
Reference in New Issue
Block a user