Skip to content
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

Adds command pa app permission list #5166

Closed

Conversation

MathijsVerbeeck
Copy link
Contributor

Closes #4645

@milanholemans milanholemans self-assigned this Jun 25, 2023
@milanholemans
Copy link
Contributor

Thank you, will try to review it ASAP

Copy link
Contributor

@milanholemans milanholemans left a comment

Choose a reason for hiding this comment

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

Good start, let's change a few things before we proceed.

docs/docs/cmd/pa/app/app-permission-list.mdx Show resolved Hide resolved
docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
Comment on lines +112 to +116
permissions.forEach(permission => {
permission.roleName = permission.properties.roleName;
permission.principalId = permission.properties.principal.id;
permission.principalType = permission.properties.principal.type;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do this only when it's really needed (when the output should be trimmed).

Copy link
Contributor Author

@MathijsVerbeeck MathijsVerbeeck Jul 6, 2023

Choose a reason for hiding this comment

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

Hi @milanholemans

I was wondering, what are you meaning exactly with when the output should be trimmed.

Currently, we have the method Cli.shouldTrimOutput, which will only trim the output when we use --output text, but that results in the following when using --output md or --output csv

image

In this case, wouldn't it be better if we do args.options.output !== json, then the output would be like this:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldTrimOutput was made so we didn't have to check each command separately when we had to modify the result. And I kinda agree that the CSV and MD output for this command is ... not so ideal indeed.
@pnp/cli-for-microsoft-365-maintainers what is the way to go right now? Just use Cli.shouldTrimOutput(...) and leave the CSV and MD output scarce as shown above?
@martinlingstuyl I know you changed some stuff about the output. Maybe you could clarify it a bit?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @milanholemans, @MathijsVerbeeck, we changed two things about the output:

  1. All columns should be shown in md and csv output. (They were trimmed before)
  2. Do not show nested objects in csv and md uitput, unless expressly requested using jmespath.

In this scenario, the question is what you would want to show; if the nested properties are really important to always show, and you don't want to change the api responses in json mode, you could of course flatten the object when output !== 'json', like Mathijs suggests.

Copy link
Contributor

Choose a reason for hiding this comment

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

So that means that the function Cli.shouldTrimOutput(...) has no use anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if you can say that without looking at where it's used. There may be valid use cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

But in this instance at least, you don't need it.

Copy link
Contributor

@milanholemans milanholemans Jul 19, 2023

Choose a reason for hiding this comment

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

I'm not sure if you can say that without looking at where it's used. There may be valid use cases.

At this point I think it has outlived its usefulness unless we add csv and md again.

src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
@milanholemans milanholemans marked this pull request as draft July 3, 2023 22:49
@MathijsVerbeeck
Copy link
Contributor Author

Hi Milan

Thanks for the review. I've changed your remarks (and left a comment at two remarks).

Could you, if you have no further questions or remarks, have another look?

Of we change our decision regarding the trimming of the output, I'll obviously change it 😉

@MathijsVerbeeck MathijsVerbeeck marked this pull request as ready for review July 19, 2023 14:16
Copy link
Contributor

@milanholemans milanholemans left a comment

Choose a reason for hiding this comment

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

We're almost there @MathijsVerbeeck, let's do a couple more changes before we merge it.

docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
docs/docs/cmd/pa/app/app-permission-list.mdx Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
src/m365/pa/commands/app/app-permission-list.ts Outdated Show resolved Hide resolved
@milanholemans milanholemans marked this pull request as draft July 20, 2023 22:41
@MathijsVerbeeck MathijsVerbeeck marked this pull request as ready for review July 21, 2023 17:56
Copy link
Contributor

@milanholemans milanholemans 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! Ready to be shipped!

@milanholemans
Copy link
Contributor

Merged manually. Thank you for this awesome new command! 👏

@MathijsVerbeeck MathijsVerbeeck deleted the pa-app-permission-list branch May 25, 2024 10:08
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.

New command: pa app permission list
3 participants