def METHOD_NAME(grant_target_name, user_name, table_type, privilege, node=None):
    """Run scenarios to check the user's access with different privileges.
    """
    exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
    with Scenario("user without privilege", setup=instrument_clickhouse_server_log):
        table_name = f"merge_tree_{getuid()}"
        with table(node, table_name, table_type):
            with When("I grant the user NONE privilege"):
                node.query(f"GRANT NONE TO {grant_target_name}")
            with And("I grant the user USAGE privilege"):
                node.query(f"GRANT USAGE ON *.* TO {grant_target_name}")
            with Then("I attempt to freeze partitions without privilege"):
                node.query(f"ALTER TABLE {table_name} FREEZE", settings = [("user", user_name)],
                    exitcode=exitcode, message=message)
    with Scenario("user with privilege", setup=instrument_clickhouse_server_log):
        table_name = f"merge_tree_{getuid()}"
        with table(node, table_name, table_type):
            with When("I grant the freeze privilege"):
                node.query(f"GRANT {privilege} ON {table_name} TO {grant_target_name}")
            with Then("I attempt to freeze partitions"):
                node.query(f"ALTER TABLE {table_name} FREEZE", settings = [("user", user_name)])
    with Scenario("user with revoked privilege", setup=instrument_clickhouse_server_log):
        table_name = f"merge_tree_{getuid()}"
        with table(node, table_name, table_type):
            with When("I grant the freeze privilege"):
                node.query(f"GRANT {privilege} ON {table_name} TO {grant_target_name}")
            with And("I revoke the freeze privilege"):
                node.query(f"REVOKE {privilege} ON {table_name} FROM {grant_target_name}")
            with Then("I attempt to freeze partitions"):
                node.query(f"ALTER TABLE {table_name} FREEZE", settings = [("user", user_name)],
                    exitcode=exitcode, message=message)