示例#1
0
def user_create(user, password, is_admin=False):
    """Create user with given password.

    If the user already exists, a DuplicateError will be raised.
    """
    get_auth_backend().require_admin()

    # XXX: We need to do a bit of refactoring, so this is available outside of
    # haas.api:
    api._assert_absent(User, user)

    user = User(user, password, is_admin=is_admin)
    db.session.add(user)
    db.session.commit()
示例#2
0
 def test_new_user(self):
     api._assert_absent(User, 'charlie')
     user_create('charlie', 'foo')
示例#3
0
文件: database.py 项目: gsilvis/haas
 def test_new_user(self):
     api._assert_absent(User, 'charlie')
     user_create('charlie', 'foo')
示例#4
0
 def test_new_user(self):
     api._assert_absent(self.dbauth.User, 'charlie')
     self.dbauth.user_create('charlie', 'foo')