Add support for roles at connection and command levels#113
Merged
alex-clickhouse merged 4 commits intomainfrom Dec 5, 2025
Merged
Add support for roles at connection and command levels#113alex-clickhouse merged 4 commits intomainfrom
alex-clickhouse merged 4 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
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
Rolesproperty onClickHouseClientSettings,ClickHouseConnectionStringBuilder, andClickHouseCommand - URI builder now includes role parameters in query strings
- Test infrastructure enhanced with
TestEnvenum 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 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.