- Notifications
You must be signed in to change notification settings - Fork 2
feat: role-management bindings & permission docs #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- Introduced `GrantRole`, `RevokeRole`, and `AreMembersOf` functions in Go bindings for managing roles across multiple wallets. - Enhanced the Python SDK with corresponding methods for granting and revoking roles, as well as checking wallet membership status. - Added `RoleMembershipStatus` TypedDict to represent membership status in Python. This update improves role management capabilities within the SDK.
- Introduced a new test suite in `test_role_management.py` to validate role management features. - Implemented tests for granting, revoking, and checking membership of roles. - Added edge case tests for permission gating and unauthorized role grants. - Ensured comprehensive coverage of role management scenarios to enhance SDK reliability.
- Updated `github.com/trufnetwork/sdk-go` dependency to version v0.3.2 in `go.mod` and `go.sum`. - Added detailed documentation for new batch operations and role management functions in `api-reference.md`, including examples and parameter descriptions. - Improved clarity on stream deployment permissions and added new sections for batch operations and role management in the API reference.
- Improved docstrings for the TNClient class, including detailed descriptions of parameters and return values for methods such as `insert_record`, `batch_insert_records`, and `set_taxonomy`. - Added notes regarding best practices for batch operations to prevent nonce errors. - Clarified the expected input types and structures for various methods, ensuring better understanding for users of the SDK.
- Updated the `github.com/trufnetwork/sdk-go` dependency version in `go.mod` and `go.sum` to v0.3.2, ensuring compatibility with the latest features and fixes.
- Enhanced the `convertToString` function to support `util.EthereumAddress` types. - Introduced a new helper function `strSliceToEthAddrs` to convert a slice of hex wallet strings to `[]util.EthereumAddress`. - Updated `GrantRole`, `RevokeRole`, and `AreMembersOf` functions to use Ethereum addresses instead of string wallets. - Added `list_role_members` method in the Python SDK to retrieve members of a role with optional pagination, returning a list of `RoleMember` dictionaries. This update improves Ethereum address handling and role management capabilities within the SDK.
- Introduced a new fixture `grant_network_writer` in `conftest.py` to facilitate granting the `network_writer` role to clients. - Added `manager_private_key` and `manager_client` fixtures in `test_trufnetwork.py` for managing elevated privileges in tests. - Created a new helper function `ensure_network_writer` in `permissions.py` to check and grant the `network_writer` role as needed. - Established a new `helpers` package to organize helper functions. This update enhances role management capabilities for testing within the SDK.
- Replaced instances of root_client with manager_client in role management tests to align with new fixture setup. - Added a new test for verifying list_role_members functionality with pagination. - Enhanced existing tests for granting, revoking, and checking role membership to utilize the manager_client for elevated permissions. This update improves the consistency and maintainability of role management tests within the SDK.
- Modified the `client` fixture in multiple test files to include the `grant_network_writer` function, ensuring that clients have the necessary permissions for testing. - This change enhances the setup for tests involving network operations, improving consistency across the test suite. This update streamlines the client initialization process and ensures proper role management in tests.
- Added `eth_account` dependency with a minimum version of 0.8.0 to the development requirements. - This update ensures that the project has the necessary tools for Ethereum account management during development.
- Added sections on role-based permissions in `README.md`, emphasizing the requirement of the `system:network_writer` role for deploying streams. - Updated `api-reference.md` to include details on role management and permissions, including who can grant roles and a table summarizing system vs. user roles. - Enhanced `examples/README.md` and `complex_example/main.py` with permission notes regarding the `system:network_writer` role for executing scripts. These changes improve documentation clarity regarding permissions and role management within the TRUF.NETWORK ecosystem.
- Removed comments in the AreMembersOf function that referenced the need for updates to the go-sdk's IRoleManagement interface. - This change cleans up the code by eliminating unnecessary notes that may cause confusion regarding the current implementation. This update enhances code clarity and maintainability within the bindings.go file.
Time Submission Status
|
MicBun approved these changes Jun 11, 2025
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.
What's inside
GrantRole,RevokeRole,AreMembersOf,ListRoleMembers.TNClientexposes matching methods + new typed dicts.sdk-goto v0.3.2; addeth_accountfor tests.system:network_writer; no self-grant guidance.Issue
Validation
pytestgreen;