def has_perm_from_args(arg_name, resource_type, perm, callback=None):

    def decorator_has_perm(func):

        @functools.wraps(func)
        def wrapper_has_perm(*args, **kwargs):
            if (not arg_name):
                return
            resource = (request.view_args.get(arg_name) or request.values.get(arg_name))
            if ((callback is not None) and resource):
                resource = callback(resource)
            if (current_app.config.get('USE_ACL') and resource):
                validate_permission(resource, resource_type, perm)
            return func(*args, **kwargs)
        return wrapper_has_perm
    return decorator_has_perm
def has_perm_from_args(arg_name, resource_type, perm, callback=None):

    def decorator_has_perm(func):

        @functools.wraps(func)
        def wrapper_has_perm(*args, **kwargs):
            if (not arg_name):
                return
            resource = (request.view_args.get(arg_name) or request.values.get(arg_name))
            if ((callback is not None) and resource):
                resource = callback(resource)
            if (current_app.config.get('USE_ACL') and resource):
                validate_permission(resource, resource_type, perm)
            return func(*args, **kwargs)
        return wrapper_has_perm
    return decorator_has_perm