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

Enhances entra user list properties #6056

Closed

Conversation

MathijsVerbeeck
Copy link
Contributor

Closes #4667

I have also noticed that we added the option type with an autocomplete in a previous PR, but we didn't validate the options being passed, resulting in the command throwing an error when we used a user type other than member or guest.

@milanholemans milanholemans self-assigned this May 19, 2024
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.

Almost good to go, let's do a few more modifications.

docs/docs/cmd/entra/user/user-list.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/entra/user/user-list.mdx Outdated Show resolved Hide resolved
docs/docs/cmd/entra/user/user-list.mdx Show resolved Hide resolved
src/m365/entra/commands/user/user-list.ts Show resolved Hide resolved
src/m365/entra/commands/user/user-list.ts Outdated Show resolved Hide resolved
src/m365/entra/commands/user/user-list.ts Outdated Show resolved Hide resolved
src/m365/entra/commands/user/user-list.spec.ts Outdated Show resolved Hide resolved
src/m365/entra/commands/user/user-list.spec.ts Outdated Show resolved Hide resolved
@milanholemans milanholemans marked this pull request as draft May 20, 2024 22:10
@MathijsVerbeeck MathijsVerbeeck marked this pull request as ready for review May 21, 2024 07:44
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.

It's working great, but let's do a few final additional changes before we merge it.

src/m365/entra/commands/user/user-list.ts Outdated Show resolved Hide resolved
src/m365/entra/commands/user/user-list.ts Show resolved Hide resolved
src/m365/entra/commands/user/user-list.ts Outdated Show resolved Hide resolved
src/m365/entra/commands/user/user-list.spec.ts Outdated Show resolved Hide resolved
@milanholemans milanholemans marked this pull request as draft May 22, 2024 22:36
@MathijsVerbeeck MathijsVerbeeck marked this pull request as ready for review May 23, 2024 10:08
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.

Looking good! Made a few more tiny changes myself during the merge, but it works great!

if (options.type) {
filter += filter.length > 0 ? ` and userType eq '${options.type}'` : `$filter=userType eq '${options.type}'`;
if (type) {
filter += filter.length > 0 ? ` and userType eq '${type}'` : `$filter=userType eq '${type}'`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Now we're checking twice if there are any filters. I think it's a lot clearer if we throw all filters in a single array and use that array as a filter string.

catch (ex: any) {
throw ex;

const unknownOptions: Options = this.getUnknownOptions(args.options);
Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, we cannot type this as Options. All properties declared in this interface will never be part of this object.

@milanholemans
Copy link
Contributor

Merged manually, thank you for this addition! 👏

@MathijsVerbeeck MathijsVerbeeck deleted the enhance-entra-user-list branch May 25, 2024 10:07
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.

Enhancement: List all properties returned by Graph when using m365 aad user list
2 participants