Esempio n. 1
0
    def test_create_user(self):

        user = User.create('*****@*****.**', 'ivan', '0000100101')
        User.remove_role('*****@*****.**', 'echo')
        # User.grant_role('*****@*****.**', 'admin')
        # User.grant_role('*****@*****.**', 'user')
        # User.grant_role('*****@*****.**', 'spy')
        print user
Esempio n. 2
0
def new_user():
    username = request.form['username']
    password = request.form['password']
    email = request.form['email']
    device = request.form.get("origin", None)
    doc = User.create(username, password, email, device)
    if 'error' in doc:
        abort(409, 'User already exists')
    else:
        Audit.signup(username, '')
        return jsonify({'user': User.to_safe_dict(doc)})