Skip to content

feat(occ): add json output option to admin-delegation:show #51124

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

leftybournes
Copy link

@leftybournes leftybournes commented Feb 28, 2025

Summary

Add option to output json with admin-delegation:show using --output=json or --output=json_pretty

Example Output (plain json):

{"currentDelegations":[{"section":"overview","delegations":[{"name":"Security & setup checks","settingId":"OCA\\Settings\\Settings\\Admin\\Overview","delegatedToGroups":""}]},{"section":"server","delegations":[{"name":"Background jobs","settingId":"OCA\\Settings\\Settings\\Admin\\Server","delegatedToGroups":""}]},{"section":"sharing","delegations":[{"name":"Global","settingId":"OCA\\Settings\\Settings\\Admin\\Sharing","delegatedToGroups":""}]},{"section":"theming","delegations":[{"name":"Global","settingId":"OCA\\Theming\\Settings\\Admin","delegatedToGroups":""}]},{"section":"ai","delegations":[{"name":"Artificial Intelligence","settingId":"OCA\\Settings\\Settings\\Admin\\ArtificialIntelligence","delegatedToGroups":""}]},{"section":"admindelegation","delegations":[{"name":"Users","settingId":"OCA\\Settings\\Settings\\Admin\\Users","delegatedToGroups":""},{"name":"Webhooks","settingId":"OCA\\WebhookListeners\\Settings\\Admin","delegatedToGroups":""}]}]}

Example Output (pretty json):

{
    "currentDelegations": [
        {
            "section": "overview",
            "delegations": [
                {
                    "name": "Security & setup checks",
                    "settingId": "OCA\\Settings\\Settings\\Admin\\Overview",
                    "delegatedToGroups": ""
                }
            ]
        },
        {
            "section": "server",
            "delegations": [
                {
                    "name": "Background jobs",
                    "settingId": "OCA\\Settings\\Settings\\Admin\\Server",
                    "delegatedToGroups": ""
                }
            ]
        },
        {
            "section": "sharing",
            "delegations": [
                {
                    "name": "Global",
                    "settingId": "OCA\\Settings\\Settings\\Admin\\Sharing",
                    "delegatedToGroups": ""
                }
            ]
        },
        {
            "section": "theming",
            "delegations": [
                {
                    "name": "Global",
                    "settingId": "OCA\\Theming\\Settings\\Admin",
                    "delegatedToGroups": ""
                }
            ]
        },
        {
            "section": "ai",
            "delegations": [
                {
                    "name": "Artificial Intelligence",
                    "settingId": "OCA\\Settings\\Settings\\Admin\\ArtificialIntelligence",
                    "delegatedToGroups": ""
                }
            ]
        },
        {
            "section": "admindelegation",
            "delegations": [
                {
                    "name": "Users",
                    "settingId": "OCA\\Settings\\Settings\\Admin\\Users",
                    "delegatedToGroups": ""
                },
                {
                    "name": "Webhooks",
                    "settingId": "OCA\\WebhookListeners\\Settings\\Admin",
                    "delegatedToGroups": ""
                }
            ]
        }
    ]
}

Checklist

@leftybournes leftybournes force-pushed the admin-delegation-json-output branch from 73bf32a to cfb7568 Compare February 28, 2025 08:54
@susnux susnux requested review from a team, icewind1991, artonge and nfebe and removed request for a team February 28, 2025 12:15
@susnux susnux added this to the Nextcloud 32 milestone Mar 2, 2025
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, only one comment about code duplication

Copy link
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good otherwise

@leftybournes leftybournes force-pushed the admin-delegation-json-output branch from cfb7568 to 1be410c Compare March 5, 2025 04:20
@leftybournes leftybournes requested a review from a team as a code owner March 5, 2025 04:20
@leftybournes leftybournes requested review from Altahrim and yemkareems and removed request for a team March 5, 2025 04:20
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have let the getDelegatedSettings block at the bottom to reduce the diff, but looks good anyway.

@leftybournes
Copy link
Author

I would have let the getDelegatedSettings block at the bottom to reduce the diff, but looks good anyway.

Thanks for the tip. I'll keep that in mind next time.

Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please add JSON output to admin-delegation:show
5 participants