code: def apply(
              self,
              query: BaseQuery,
              func: Callable) -> BaseQuery:
          
          if security_manager.can_only_access_owned_queries():
              query = (
                  query
                  .filter(Query.user_id == g.user.get_user_id())
              )
          return query
docs: Filter queries to only those owned by current user if
          can_only_access_owned_queries permission is set.
  
          :returns: query