Skip to content

Add support for roles at connection and command levels#113

Merged
alex-clickhouse merged 4 commits intomainfrom
roles
Dec 5, 2025
Merged

Add support for roles at connection and command levels#113
alex-clickhouse merged 4 commits intomainfrom
roles

Conversation

@alex-clickhouse
Copy link
Copy Markdown
Collaborator

No description provided.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ClickHouse.Driver/ClickHouseUriBuilder.cs 75.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for ClickHouse roles at both connection and command levels, enabling fine-grained permission control. It introduces the ability to specify roles via connection strings or settings, and to override connection-level roles on a per-command basis.

Key changes:

  • New Roles property on ClickHouseClientSettings, ClickHouseConnectionStringBuilder, and ClickHouseCommand
  • URI builder now includes role parameters in query strings
  • Test infrastructure enhanced with TestEnv enum to distinguish between local, cloud, and quick-setup environments
  • Comprehensive test suite covering role behavior and permissions
  • CI workflow refactoring to extract platform-specific tests into reusable workflows

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/Advanced_006_Roles.cs New example demonstrating role-based access control at connection and command levels
examples/Program.cs Integration of new roles example into example runner
examples/README.md Documentation entry for new roles example
ClickHouse.Driver/ADO/ClickHouseClientSettings.cs Added Roles property with init accessor, copy constructor support, equality/hash code handling
ClickHouse.Driver/ADO/ClickHouseConnectionStringBuilder.cs Added Roles property with CSV parsing and serialization
ClickHouse.Driver/ADO/ClickHouseConnection.cs Wired connection-level roles to URI builder
ClickHouse.Driver/ADO/ClickHouseCommand.cs Added Roles property for per-command role overrides
ClickHouse.Driver/ClickHouseUriBuilder.cs Implemented role query parameter generation with command-level override logic
ClickHouse.Driver/PublicAPI/PublicAPI.Unshipped.txt Public API surface tracking for new role-related members
ClickHouse.Driver.Tests/ADO/RolesTests.cs Comprehensive integration tests for role functionality and permissions
ClickHouse.Driver.Tests/ADO/ConnectionStringBuilderTests.cs Tests for role parsing, trimming, and round-trip conversion
ClickHouse.Driver.Tests/ADO/ClickHouseClientSettingsTests.cs Tests for settings role property, equality, and serialization
ClickHouse.Driver.Tests/Misc/UriBuilderTests.cs Tests for role inclusion in generated URIs
ClickHouse.Driver.Tests/Utilities/TestUtilities.cs New TestEnv enum and environment detection for environment-specific test filtering
.github/workflows/tests.yml Refactored to call reusable workflows for platform-specific tests
.github/workflows/tests-windows.yml Extracted Windows tests with local_quick_setup environment
.github/workflows/tests-macos.yml Extracted macOS tests with local_quick_setup environment
.github/workflows/tests-integration.yml Extracted integration tests with local_single_node environment
.github/workflows/tests-cloud.yml Extracted cloud tests with cloud environment
.github/workflows/reusable.yml Added CLICKHOUSE_TEST_ENVIRONMENT variable for regression tests

Comment thread examples/Program.cs Outdated
Comment thread ClickHouse.Driver/ADO/ClickHouseConnection.cs
Comment thread ClickHouse.Driver.Tests/Utilities/TestUtilities.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@alex-clickhouse alex-clickhouse merged commit a118d5e into main Dec 5, 2025
17 checks passed
@alex-clickhouse alex-clickhouse deleted the roles branch December 5, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants