def get_users(current_user):
    user = UserModel.get_user_by_id(current_user)
    if user['role'] != "admin":
        return jsonify(
            {"message": "You are not authorised to view this function"}), 401
    users_list = UserModel.get_users()
    return jsonify({
        'Users of ManagerStore':
        [make_public_user(user) for user in users_list]
    }), 200
Example #2
0
def get_users():
    users_list = UserModel.get_users()
    if users_list == "No Users":
        return jsonify({'users': users_list}), 404
    return jsonify({'users': users_list}), 200