Filter queries to only those owned by current user if
        can_only_access_owned_queries permission is set.

        :returns: query

def apply(
            self,
            query: BaseQuery,
            func: Callable) -> BaseQuery:
        """
        Filter queries to only those owned by current user if
        can_only_access_owned_queries permission is set.

        :returns: query
        """
        if security_manager.can_only_access_owned_queries():
            query = (
                query
                .filter(Query.user_id == g.user.get_user_id())
            )
        return query