-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
admin-delegation occ - add output option for show command to support JSON formats #55260
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
admin-delegation occ - add output option for show command to support JSON formats #55260
Conversation
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 enhances the occ admin-delegation:show command by adding JSON output format support, enabling programmatic access to delegation information while maintaining backward compatibility with the existing table format.
- Added
--outputoption with support forplain,json, andjson_prettyformats - Refactored data collection and formatting logic to support structured JSON output
- Implemented proper validation and error handling for output format options
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
come-nc
left a comment
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.
When extending OC\Core\Command\Base, there is already an output option, you do not need to add it.
a84d419 to
eb9a960
Compare
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
prepare to add json output Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
… methods - Extract collectDelegationData() method to eliminate code duplication - Add formatSettingsData() method for consistent data formatting - Add outputPlainFormat() method to separate concerns - Add proper empty state handling with user-friendly message Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
- Add --output option supporting plain, json, and json_pretty formats - Add validateOutputFormat() method for input validation - Implement proper error handling for invalid output formats - Support empty state handling for both plain and JSON outputs - Use Base class writeArrayInOutputFormat() for consistent JSON output - Maintain backward compatibility with plain format as default Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
eb9a960 to
c04398c
Compare
|
Failures are not related |
|
/backport to stable31 |
|
/backport to stable32 |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Overview
This PR enhances the
occ admin-delegation:showcommand by adding support for JSON output formats, providing a more programmatic way to access delegation information.Changes Made
Enhanced Command Options: Added
--outputoption to theadmin-delegation:showcommand with support for:plain(default) - existing table formatjson- compact JSON outputjson_pretty- formatted JSON outputNew Import: Added
Symfony\Component\Console\Input\InputOptionimport to support the new option parameterImproved Data Structure: Implemented structured JSON output that includes:
Usage
JSON Output
[ { "id": "overview", "name": "Overview", "settings": [ { "name": "Security & setup checks", "className": "OCA\\Settings\\Settings\\Admin\\Overview", "delegatedGroups": [] } ] }, { "id": "server", "name": "Basic settings", "settings": [ { "name": "Background jobs", "className": "OCA\\Settings\\Settings\\Admin\\Server", "delegatedGroups": [] } ] }, { "id": "sharing", "name": "Sharing", "settings": [ { "name": "Global", "className": "OCA\\Settings\\Settings\\Admin\\Sharing", "delegatedGroups": [] } ] }, { "id": "theming", "name": "Theming", "settings": [ { "name": "Global", "className": "OCA\\Theming\\Settings\\Admin", "delegatedGroups": [] } ] }, { "id": "ai", "name": "Assistant", "settings": [ { "name": "Artificial Intelligence", "className": "OCA\\Settings\\Settings\\Admin\\ArtificialIntelligence", "delegatedGroups": [] } ] }, { "id": "admindelegation", "name": "Administration privileges", "settings": [ { "name": "Users", "className": "OCA\\Settings\\Settings\\Admin\\Users", "delegatedGroups": [] }, { "name": "Webhooks", "className": "OCA\\WebhookListeners\\Settings\\Admin", "delegatedGroups": [] } ] } ]Benefits
Technical Details
Baseclass output formatting methodsFiles Changed
apps/settings/lib/Command/AdminDelegation/Show.phpThis enhancement improves the usability of the admin delegation system for both interactive use and automation scenarios.
Checklist
3. to review, feature component)stable32)