Skip to content

Commit

Permalink
Update manage.py to use permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr committed Mar 12, 2014
1 parent 13f3a5e commit 97b163b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 97b163b

Please sign in to comment.