Complete Channel Invitation Workflow and Resolve Registration UI Bugs - #818
Complete Channel Invitation Workflow and Resolve Registration UI Bugs#818Pranav-d33 wants to merge 15 commits into
Conversation
Adds invitation endpoints to the Channel API — replaces the one-step `add_organization` flow with a proper Fabric channel update workflow.
### New Endpoints
- GET /invitations - List invitations visible to org (any member)
- POST /invitations - Create invitation + generate artifact (admin)
- GET /invitations/{id} - Retrieve invitation details (visibility-gated)
- POST /invitations/{id}/cancel - Cancel invitation (member-admin only)
### Design Decisions
- Admin-only mutations: create/cancel require is_admin
- Signature threshold: all current members by default, overridable
- Cancelable states: DRAFT, SIGNING, FAILED, READY
- Cancel vs Reject (PR 6): Cancel hard-stops the whole invitation. Reject is per-invitee decline.
- Who can cancel: Channel member admin only
- Duplicate protection: Rejects if invitee has PENDING invitee on active invitation
- Reinvite allowed after CANCELED or REJECTED
### Files
views.py: 3 @action methods + helpers
serializers.py: create calls agent, CancelSerializer, duplicate validation
service.py: create_invitation_artifact() agent call
tests.py: 12 endpoint tests (APIClient+JWT), 13 model tests with mocks
Test: 32/32 pass, flake8 clean.
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
- Add msp_id field to Organization (auto-derives from name as fallback) - Update create_invitation_artifact to pass o.msp_id instead of str(o.id) - Update auth serializer and org service to accept msp_id - Fix pre-existing enum metaclass crash on Python 3.13 - Fix missing max_length on Organization and Chaincode CharFields - Add proper error handling for agent failures in view Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Adds POST /channels/{channel_name}/invitations/definition on the Fabric agent.
Service generates unsigned channel update artifact:
1. Fetch + decode channel config
2. Build org group entries (MSP + AnchorPeers) with base64 PEM certs
3. Compute config update diff via configtxlator
4. Wrap in unsigned envelope, encode to protobuf
5. Return bytes, clean up temp files
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
- Fabric agent: sign_config_update() service, InvitationSignSerializer, invitation_sign endpoint - API engine: sign_invitation_artifact() service, ChannelInvitationSignSerializer, sign_invitation endpoint - Auto-transitions DRAFT->SIGNING->READY at signature threshold; FAILED on agent error - 42 API engine tests pass (8 new sign tests + 34 existing) - Fix: invitations POST returning 200 instead of 201 (pre-existing bug) - Fix: sign endpoint returning 403 instead of 404 for non-members - Add test_settings.py for SQLite-based local test runs Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Fabric agent: - join_channel() service: submits signed config update, fetches block, joins peer - InvitationJoinSerializer, invitation_join endpoint (POST .../invitations/join) API engine: - accept_invitation() service helper: contacts agent join endpoint - ChannelInvitationAcceptSerializer: validates READY status + PENDING invitee, calls agent, adds org to channel, marks ACCEPTED - ChannelInvitationRejectSerializer: validates READY status + PENDING invitee, marks REJECTED (no agent call) - accept_invitation and reject_invitation view actions with 404/400/500 handling - 49 channel tests pass (7 new accept/reject tests + 42 existing) Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Add the Channel Invitation UI page completing the channel invitation workflow. This PR covers: - Invitation list table with status badges (DRAFT/SIGNING/READY/ACCEPTED/ REJECTED/FAILED/CANCELED) and channel selector dropdown - Per-row action buttons gated by role, channel membership, and invitation state: Sign (member admin), Accept/Reject (pending invitee), and Cancel (creator admin) - Create-invitation modal with org multi-select picker and optional required-signatures input - Invitations row-action link on the Channel Management page - Route at /channel/invitation (hidden from sidebar) - Locale strings in en-US and zh-CN (40 keys) - 48 pure-function unit tests (service URL/method assertions, saga effect stepping, permission-gate truth table, form validation) plus jest.config.js for @/ alias resolution in test environment - ESLint clean Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
…ation UI Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
a229e72 to
88544bb
Compare
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
8a88e13 to
4ad0347
Compare
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
4ad0347 to
5213f95
Compare
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav Dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
5e9fdc8 to
90a5526
Compare
|
Hi , @yeasy @YoungHypo @dodo920306 I have completed the implementation of the Channel Invitation Workflow feature for Hyperledger Cello. This workflow introduces a secure, multi-party consensus process to automate the complex lifecycle of adding new organizations to an existing channel. Below is an overview of the practical implementation, user roles, and the process flow: Problem Solved (Practical Implementation)Historically, adding a new organization to a Fabric channel required a sequence of manual tasks (fetching the config block, converting to JSON, appending MSP credentials, calculating the configuration delta, gathering cryptographic signatures from existing members, and submitting the update transaction). This implementation automates this entire lifecycle. Cello now handles the orchestration, coordinating artifact generation, signature collection, and the channel-joining step directly via Agent APIs and a new web dashboard interface. User Roles & Access Control
Process Flow & LifecycleThe invitation status transitions through a strict state machine:
Validation & Integrity Guardrails
I look forward to your feedback and review on this contribution. |
|
Thanks for the work here, @Pranav-d33 — but this PR is quite large and mixes the invitation feature with unrelated changes (CI/lockfile, compose edits, docs whitespace, an Overview rewrite), which makes it hard to review properly. Could you split it into smaller, independently reviewable PRs (e.g. invitation backend+agent / dashboard UI / CI+compose / registration fixes)? |
|
@YoungHypo To give some context: while I was building out the invitation architecture we discussed, I ran into several local environment issues (like the registration flow being broken and some compose misconfigurations) that I had to fix just to test the feature end-to-end. I also bundled in some CI linting fixes and documentation updates that I noticed along the way. Because it was all done on stacked branches, it got mixed into this single PR. I agree it will be much easier to review if separated. I will go ahead and close this PR (or leave it open as a reference) and break the work out into the smaller, independently reviewable PRs as you suggested: Infrastructure & Bug Fixes: CI/lockfile, compose edits, and registration fixes. I'll link the new PRs here once they are up. |
Description
This PR marks the completion of the implementation phase for the Channel Invitation Workflow. The core task is now fully complete, and only the final documentation remains to be written. This update introduces several critical UI, security, and integration fixes across the dashboard, ensuring architectural alignment with contributor guidelines and improving the end-to-end reliability of user registration and channel management.
Major Features & UI Polish
Overview/index.js, etc.) to improve code quality.Security & Bug Fixes
no-underscore-dangleissues inmodels/login.jsand fixed unresolved path imports in test files to pass strict ESLint pre-commit hooks.How to Test
npm run lint-staged:jspasses with zero errors.Notes for Reviewers
All frontend modifications have been cross-referenced with the latest backend API schemas to ensure data consistency. The local development Docker environment should now successfully orchestrate the end-to-end flows. The implementation is considered feature-complete; a follow-up PR will contain the official technical documentation.