def getUserByName(key=None): if key is None: abort(404) u = User.get_by_name(key) if u: return jsonify({'user': u}) else: user = User.get_user(key) if user: return jsonify({'user': json.loads(user)}) else: abort(404)
def add_user_to_group(): key = request.form['login_key'] bid = request.form['blibb_id'] username = request.form['username'] user = get_key(key) res = dict() if is_valid_id(bid): user_to_add = User.get_by_name(username) if user_to_add: if Blibb.can_write(user, '', bid): Blibb.add_user_to_group(username, bid) res['result'] = 'ok' else: res['error'] = 'Not permissions' else: res['error'] = 'User not found' else: res['error'] = 'Object Id is not valid' return jsonify(res)