-
Notifications
You must be signed in to change notification settings - Fork 0
add support for deleting IONOS mailboxes when a user is deleted #17
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
Conversation
7c03137 to
7dbbd0c
Compare
7dbbd0c to
eec8415
Compare
…251110130214 https://github.com/IONOS-Productivity/ionos-mail-configuration-api-client/releases/tag/2.0.0-20251110130214 Signed-off-by: Misha M.-Kupriyanov <[email protected]>
9728b08 to
1f810b4
Compare
There was a problem hiding this 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 updates the IONOS Mail API client reference to version 2.0.0-20251110130214 and implements associated changes to handle the updated API, including renaming classes and methods to align with the new client version, and adding functionality to delete IONOS email accounts when users are removed.
- Updates IONOS Mail API client reference from 2.0.0-20251031093901 to 2.0.0-20251110130214
- Renames
ErrorMessagetoMailAddonErrorMessagethroughout the codebase - Renames API method from
newEventAPIApitonewMailConfigurationAPIApi - Adds IONOS mailbox deletion capability in
UserDeletedListener
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| composer.json | Updates the IONOS Mail API client git reference version |
| lib/Service/IONOS/ApiMailConfigClientService.php | Renames method from newEventAPIApi to newMailConfigurationAPIApi |
| lib/Service/IONOS/IonosConfigService.php | Adds methods to check mail config and IONOS integration status |
| lib/Service/IONOS/IonosMailConfigService.php | Refactors to use IonosConfigService instead of directly accessing IConfig |
| lib/Service/IONOS/IonosMailService.php | Updates to use MailAddonErrorMessage, adds HTTP constants, implements deleteEmailAccount method and createApiInstance helper |
| lib/Listener/UserDeletedListener.php | Adds IONOS mailbox deletion when users are deleted |
| tests/Unit/Service/IONOS/ApiMailConfigClientServiceTest.php | Updates test method calls to use renamed API method |
| tests/Unit/Service/IONOS/IonosConfigServiceTest.php | Adds tests for new configuration checking methods |
| tests/Unit/Service/IONOS/IonosMailConfigServiceTest.php | Updates tests to use IonosConfigService mock |
| tests/Unit/Service/IONOS/IonosMailServiceTest.php | Updates all tests to use renamed classes and methods, adds comprehensive tests for new delete functionality |
| tests/Unit/Listener/UserDeletedListenerTest.php | New test file providing comprehensive coverage for user deletion scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…arity Updated the method name from `newEventAPIApi` to `newMailConfigurationAPIApi` to better reflect its purpose in creating a new MailConfiguration API instance. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
1f810b4 to
dccbc8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add IONOS mailbox deletion support to AccountService - When a mail account is deleted, check if it's an IONOS account by comparing email domain - Automatically delete the IONOS mailbox via IonosMailService.tryDeleteEmailAccount() - Graceful error handling ensures Nextcloud account deletion proceeds even if IONOS deletion fails - Add comprehensive unit tests for IONOS account deletion scenarios - Complements existing user deletion functionality from PR #17 This ensures IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Added comprehensive unit tests for the UserDeletedListener to ensure proper handling of user deletion events, including scenarios with no accounts, single and multiple accounts, client exceptions, and partial failures. This enhances test coverage and reliability of the mail account deletion process. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…deletion process Improves code clarity by storing user ID in a variable before use in account deletion. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
… mail configuration checks This change encapsulates the logic for checking if the IONOS mail configuration feature is enabled within a dedicated service, improving code organization and readability. The existing mail configuration checks in IonosMailConfigService have been refactored to utilize this new service. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
…integration checks - Added isIonosIntegrationEnabled method to verify full integration configuration. - Updated isMailConfigAvailable method to utilize the new integration check. - Enhanced unit tests to cover new integration validation scenarios. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
dccbc8d to
562514c
Compare
…n user deletion Add functionality to delete the IONOS mailbox when a user is deleted, if the IONOS integration is enabled. This enhances the user deletion process by ensuring associated email accounts are also removed, improving data management and compliance. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
562514c to
3071fa3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add IONOS mailbox deletion support to AccountService - When a mail account is deleted, check if it's an IONOS account by comparing email domain - Automatically delete the IONOS mailbox via IonosMailService.tryDeleteEmailAccount() - Graceful error handling ensures Nextcloud account deletion proceeds even if IONOS deletion fails - Add comprehensive unit tests for IONOS account deletion scenarios - Complements existing user deletion functionality from PR #17 This ensures IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
- Add IONOS mailbox deletion support to AccountService - When a mail account is deleted, check if it's an IONOS account by comparing email domain - Automatically delete the IONOS mailbox via IonosMailService.tryDeleteEmailAccount() - Graceful error handling ensures Nextcloud account deletion proceeds even if IONOS deletion fails - Add comprehensive unit tests for IONOS account deletion scenarios - Complements existing user deletion functionality from PR #17 This ensures IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
- Add IONOS mailbox deletion support to AccountService - When a mail account is deleted, check if it's an IONOS account by comparing email domain - Automatically delete the IONOS mailbox via IonosMailService.tryDeleteEmailAccount() - Graceful error handling ensures Nextcloud account deletion proceeds even if IONOS deletion fails - Add comprehensive unit tests for IONOS account deletion scenarios - Complements existing user deletion functionality from PR #17 This ensures IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Add automatic IONOS mailbox deletion when users delete their mail accounts in Nextcloud. - Introduce IonosAccountDeletionService to handle mailbox cleanup logic - Integrate deletion hook into AccountService.delete() and deleteByAccountId() - Verify account ownership by comparing email domain and provisioned email - Add graceful error handling to ensure NC account deletion proceeds even if IONOS deletion fails - Implement comprehensive unit tests for all deletion scenarios - Add IonosMailService.getIonosEmailForUser() to retrieve provisioned email addresses This complements existing user deletion functionality from PR #17 by ensuring IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Add automatic IONOS mailbox deletion when users delete their mail accounts in Nextcloud. - Introduce IonosAccountDeletionService to handle mailbox cleanup logic - Integrate deletion hook into AccountService.delete() and deleteByAccountId() - Verify account ownership by comparing email domain and provisioned email - Add graceful error handling to ensure NC account deletion proceeds even if IONOS deletion fails - Implement comprehensive unit tests for all deletion scenarios - Add IonosMailService.getIonosEmailForUser() to retrieve provisioned email addresses This complements existing user deletion functionality from PR #17 by ensuring IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Add automatic IONOS mailbox deletion when users delete their mail accounts in Nextcloud. - Introduce IonosAccountDeletionService to handle mailbox cleanup logic - Integrate deletion hook into AccountService.delete() and deleteByAccountId() - Verify account ownership by comparing email domain and provisioned email - Add graceful error handling to ensure NC account deletion proceeds even if IONOS deletion fails - Implement comprehensive unit tests for all deletion scenarios - Add IonosMailService.getIonosEmailForUser() to retrieve provisioned email addresses This complements existing user deletion functionality from PR #17 by ensuring IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Add automatic IONOS mailbox deletion when users delete their mail accounts in Nextcloud. - Introduce IonosAccountDeletionService to handle mailbox cleanup logic - Integrate deletion hook into AccountService.delete() and deleteByAccountId() - Verify account ownership by comparing email domain and provisioned email - Add graceful error handling to ensure NC account deletion proceeds even if IONOS deletion fails - Implement comprehensive unit tests for all deletion scenarios - Add IonosMailService.getIonosEmailForUser() to retrieve provisioned email addresses This complements existing user deletion functionality from PR #17 by ensuring IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Add automatic IONOS mailbox deletion when users delete their mail accounts in Nextcloud. - Introduce IonosAccountDeletionService to handle mailbox cleanup logic - Integrate deletion hook into AccountService.delete() and deleteByAccountId() - Verify account ownership by comparing email domain and provisioned email - Add graceful error handling to ensure NC account deletion proceeds even if IONOS deletion fails - Implement comprehensive unit tests for all deletion scenarios - Add IonosMailService.getIonosEmailForUser() to retrieve provisioned email addresses This complements existing user deletion functionality from PR #17 by ensuring IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
Add automatic IONOS mailbox deletion when users delete their mail accounts in Nextcloud. - Introduce IonosAccountDeletionService to handle mailbox cleanup logic - Integrate deletion hook into AccountService.delete() and deleteByAccountId() - Verify account ownership by comparing email domain and provisioned email - Add graceful error handling to ensure NC account deletion proceeds even if IONOS deletion fails - Implement comprehensive unit tests for all deletion scenarios - Add IonosMailService.getIonosEmailForUser() to retrieve provisioned email addresses This complements existing user deletion functionality from PR #17 by ensuring IONOS mailboxes are properly cleaned up when users delete their mail accounts, not just when the entire user is deleted from the system. Signed-off-by: Misha M.-Kupriyanov <[email protected]>
TODO:
This pull request introduces robust support for deleting IONOS mailboxes when a user is deleted, improves the detection and configuration checks for IONOS integration, and refactors the IONOS API client usage for clarity and maintainability. It also adds comprehensive tests for the new configuration logic and updates naming for consistency.
IONOS Integration Improvements
isIonosIntegrationEnabledandisMailConfigEnabledmethods toIonosConfigServiceto centralize and clarify checks for whether the IONOS integration is enabled and properly configured. These methods are now used throughout the codebase to ensure that actions are only performed when integration is fully set up. [1] [2]IonosMailConfigServiceto use the newIonosConfigService::isIonosIntegrationEnabled()method, ensuring that IONOS mail configuration options are only shown when the integration is correctly configured. [1] [2]User Deletion Handling
UserDeletedListenerto attempt deletion of the user's IONOS mailbox via the API if the integration is enabled, logging success or failure, and ensuring Nextcloud mail accounts are still removed even if the IONOS deletion fails. [1] [2] [3]deleteEmailAccountmethod inIonosMailServiceto handle mailbox deletion via the IONOS API, including proper error handling and logging.API Client Refactoring
newEventAPIApitonewMailConfigurationAPIApifor clarity and updated all usages and tests accordingly. Added a newcreateApiInstancehelper inIonosMailServiceto centralize API client instantiation. [1] [2] [3] [4] [5] [6] [7] [8]Error Handling and Consistency
IonosMailServiceby using HTTP status code constants, updating exception handling, and using the correct error model classes from the IONOS API client. [1] [2] [3] [4]Testing
IonosConfigService, covering all cases for enabling/disabling the feature and handling missing configuration.Dependency Update
composer.jsonto a newer version.https://github.com/IONOS-Productivity/ionos-mail-configuration-api-client/releases/tag/2.0.0-20251110130214