def user_required(f):

    def __inner__(self, *args, **kwargs):
        identify = get_jwt_identity()
        user = models.User.find_by_username(identify)
        if (user and (user.role in ['admin', 'user'])):
            return f(self, user, *args, **kwargs)
        return ({'message': 'Not found'}, 404)
    return jwt_required(__inner__)
def user_required(f):

    def __inner__(self, *args, **kwargs):
        identify = get_jwt_identity()
        user = models.User.find_by_username(identify)
        if (user and (user.role in ['admin', 'user'])):
            return f(self, user, *args, **kwargs)
        return ({'message': 'Not found'}, 404)
    return jwt_required(__inner__)