def can_access_resources(resource_type):

    def decorator_can_access_resources(func):

        @functools.wraps(func)
        def wrapper_can_access_resources(*args, **kwargs):
            if current_app.config.get('USE_ACL'):
                res = ACLManager().get_resources(resource_type)
                result = {i.get('name'): i.get('permissions') for i in res}
                if hasattr(g, 'resources'):
                    g.resources.update({resource_type: result})
                else:
                    g.resources = {resource_type: result}
            return func(*args, **kwargs)
        return wrapper_can_access_resources
    return decorator_can_access_resources
def can_access_resources(resource_type):

    def decorator_can_access_resources(func):

        @functools.wraps(func)
        def wrapper_can_access_resources(*args, **kwargs):
            if current_app.config.get('USE_ACL'):
                res = ACLManager().get_resources(resource_type)
                result = {i.get('name'): i.get('permissions') for i in res}
                if hasattr(g, 'resources'):
                    g.resources.update({resource_type: result})
                else:
                    g.resources = {resource_type: result}
            return func(*args, **kwargs)
        return wrapper_can_access_resources
    return decorator_can_access_resources