Conversation
…ransfer in organisations This mutation allows the current owner of an organisation to transfer ownership to another member, ensuring the new owner has the necessary admin role and updating relevant roles and Stripe customer email as needed.
…ransfer This function updates the Stripe customer email when an organisation's ownership is transferred, ensuring accurate customer information. It includes error handling and notifications for failures.
This update integrates the TransferOrganisationOwnershipMutation into the Mutation class, allowing for the management of organisation ownership transfers within the GraphQL API.
This commit introduces a new GraphQL mutation, TransferOrganisationOwnership, which facilitates the transfer of ownership for an organisation. It accepts parameters for the organisation ID, new owner ID, and optional billing email, enhancing the API's functionality for managing ownership transitions.
…n ownership transfers This commit introduces the TransferOwnershipSection component, allowing current owners to transfer ownership of an organisation to eligible members. It includes a dialog for selecting a new owner, checks for global access permissions, and provides user feedback on the transfer process. The component integrates with existing GraphQL queries and mutations to facilitate the ownership transfer functionality.
This update adds the TransferOwnershipSection component to the organisation settings page, enhancing the user interface for managing ownership transfers. The new section provides a seamless experience for current owners to initiate ownership transfers directly within the settings.
There was a problem hiding this comment.
Pull request overview
This PR implements organisation ownership transfer functionality, allowing owners to transfer their role to another admin member. The feature is implemented with a new "Danger Zone" section in Organisation Settings, includes backend validation and Stripe billing integration, and fixes UI scrollbar issues.
Changes:
- Adds organisation ownership transfer mutation and UI workflow with security validations
- Integrates Stripe customer email update for cloud-hosted instances
- Fixes double scrollbar issues in Settings and Access pages
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/graphql/mutations/organisation/transferOwnership.gql | GraphQL mutation definition for transferring organisation ownership |
| frontend/components/settings/organisation/TransferOwnershipSection.tsx | Main UI component implementing the ownership transfer workflow with member selection and confirmation |
| frontend/app/[team]/settings/page.tsx | Integrates TransferOwnershipSection into settings page and removes overflow-y-auto to fix scrollbar issue |
| frontend/app/[team]/access/layout.tsx | Updates layout styling to use flex-1 overflow-y-auto to fix double scrollbar |
| backend/ee/billing/stripe.py | Adds update_stripe_customer_email function to update Stripe customer when ownership changes |
| backend/backend/schema.py | Registers the new TransferOrganisationOwnershipMutation in the GraphQL schema |
| backend/backend/graphene/mutations/organisation.py | Implements backend mutation with role swapping, org identity_key update, and Stripe integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
This commit introduces two new email templates: one for the new owner and another for the old owner, notifying them of the ownership transfer. The templates provide personalized messages and relevant links to enhance user experience during the transition.
This commit adds functionality to send email notifications to both the old and new owners during the organisation ownership transfer process. It includes error handling for potential issues when sending the emails.
This commit introduces a new Checkbox component, allowing users to select options with customizable sizes and labels. The component includes accessibility features and visual feedback for checked states, enhancing the user interface for forms and settings.
…tion and UI updates This commit refactors the TransferOwnershipSection component to utilize a Combobox for member selection, improving user experience. It introduces a new Alert component for better feedback and updates the dialog to fetch eligible members dynamically. The UI has been streamlined with clearer messaging and improved layout, ensuring a more intuitive ownership transfer process.
This commit introduces a comprehensive suite of unit tests for the permission utilities, including functions like userHasGlobalAccess, userIsAdmin, userHasPermission, and parsePermissions. The tests cover various scenarios, ensuring robust validation of permission logic and handling of different permission structures. This addition enhances code reliability and facilitates future development.
This commit introduces a comprehensive suite of unit tests for the TransferOrganisationOwnershipMutation GraphQL mutation. The tests cover various scenarios, including successful ownership transfers, permission checks for non-owners, and restrictions against transferring ownership to oneself or to members without global access. This addition enhances the reliability of the ownership transfer functionality and ensures proper handling of edge cases.
…rshipMutation This commit adds a check to ensure that the new owner has a valid identity key before transferring ownership. If the identity key is missing, a GraphQLError is raised, prompting the user to complete their account setup. This enhancement improves the robustness of the ownership transfer process by ensuring that only eligible members can be assigned ownership.
This commit introduces two unit tests to validate that ownership cannot be transferred to members with null or empty identity keys. Both tests ensure that a GraphQLError is raised with appropriate messages, enhancing the robustness of the TransferOrganisationOwnershipMutation by enforcing identity key requirements.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
rohan-chaturvedi
left a comment
There was a problem hiding this comment.
A few suggestions. Also, I think you missed updating the graphql schema and frontend types
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
frontend/components/settings/organisation/TransferOwnershipSection.tsx
Outdated
Show resolved
Hide resolved
…alog for improved ownership transfer flow This commit refactors the TransferOwnershipSection component by removing unnecessary state management and integrating a GenericDialog for handling the ownership transfer process. It enhances the user experience by ensuring that only owners can access the transfer functionality and simplifies the dialog management with a reference. The overall structure is optimized for better readability and maintainability.
…OrganisationOwnershipMutation This commit enhances the TransferOrganisationOwnershipMutation by wrapping the ownership transfer process in a database transaction. This ensures that all changes are applied atomically, preventing inconsistent states during the transfer of ownership. The changes include setting the new owner's role, updating the organisation's identity key, and demoting the current owner, all within a single transaction block.
…tion.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nimish <85357445+nimish-ks@users.noreply.github.com>
…sole into feat--org-ownership-transfer
This commit updates the test cases in test_transfer_ownership.py to include a mock transaction for the ownership transfer process. The changes ensure that the transaction is properly mocked in various test scenarios, enhancing the reliability of the tests and maintaining consistency in the ownership transfer logic.
…s into single-line definitions This commit refactors the GraphQL schema by consolidating multiline argument definitions into single-line format for better readability and consistency. Additionally, it updates comments to a more concise format while maintaining clarity.
This commit introduces the TransferOrganisationOwnership mutation to the GraphQL schema, allowing for the transfer of organisation ownership between members. It includes the necessary types and arguments for the mutation, ensuring that the new owner has the required permissions. Additionally, it updates the AppType to accommodate potential null values for service accounts.
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
🔍 Overview
This PR implements the functionality to transfer organisation ownership from the current owner to another member. It introduces a new "Danger Zone" section in the Organisation Settings page, allowing the owner to securely transfer their role. Additionally, it includes UI fixes for double scrollbars observed in the Settings and Access pages.
Docs: phasehq/docs#201
💡 Proposed Changes
Organisation Ownership Transfer
TransferOwnershipSectionwhich handles the UI for initiating the transfer.transferOrganisationOwnershipmutation which:identity_keyto match the new owner's.UI/UX Improvements
app/[team]/settings/page.tsxapp/[team]/access/layout.tsxapp/[team]/access/members/[memberId]/page.tsxRoleSelector.tsxto maintain separation of concerns.🖼️ Screenshots or Demo
(Add screenshots of the new Danger Zone section and the Transfer Ownership modal here)
📝 Release Notes
❓ Open Questions
🧪 Testing
update_stripe_customer_emailis called with the provided email.🎯 Reviewer Focus
frontend/components/settings/organisation/TransferOwnershipSection.tsx: Main UI logic for the feature.backend/backend/graphene/mutations/organisation.py: Core backend logic for the transfer.frontend/app/[team]/settings/page.tsx: Integration of the new section and layout fixes.➕ Additional Context
The transfer process requires the new owner to have global access (Admin role) because they need to be able to decrypt all environment keys. The backend enforces this check.
✨ How to Test the Changes Locally
💚 Did You...