code: def get_dataset_access_filters(
      base_model: type[Model],
      *args: Any,
  ) -> BooleanClauseList:
      # pylint: disable=import-outside-toplevel
      from superset import security_manager
      from superset.connectors.sqla.models import Database
  
      database_ids = security_manager.get_accessible_databases()
      perms = security_manager.user_view_menu_names("datasource_access")
      schema_perms = security_manager.user_view_menu_names(
          "schema_access"
      )
  
      return or_(
          Database.id.in_(database_ids),
          base_model.perm.in_(perms),
          base_model.schema_perm.in_(schema_perms),
          *args,
      )
  
imports: from typing import Any
  from flask_appbuilder import Model
  from sqlalchemy import or_
  from sqlalchemy.sql.elements import BooleanClauseList
label_desc: Use image node_id 1 for calling a global function with example usage: get_dataset_access_filters(base_model) and returns: or_