From 3964f60ade5d867f7015825cf12767c4da1f18be Mon Sep 17 00:00:00 2001 From: Mathijs Verbeeck Date: Mon, 30 Sep 2024 23:43:23 +0200 Subject: [PATCH 1/3] Renames `entra group user` to `entra group member`. Closes #6396 --- docs/docs/about/release-notes.mdx | 6 +- .../docs/cmd/entra/group/group-member-add.mdx | 62 +++++++++++++++++++ ...up-user-list.mdx => group-member-list.mdx} | 28 ++++----- .../docs/cmd/entra/group/group-member-set.mdx | 62 +++++++++++++++++++ docs/docs/cmd/entra/group/group-user-add.mdx | 62 ------------------- docs/docs/cmd/entra/group/group-user-set.mdx | 62 ------------------- docs/docs/v10-upgrade-guidance.mdx | 13 +++- docs/src/config/sidebars.ts | 12 ++-- src/m365/entra/commands.ts | 6 +- ...r-add.spec.ts => group-member-add.spec.ts} | 6 +- ...{group-user-add.ts => group-member-add.ts} | 10 +-- ...list.spec.ts => group-member-list.spec.ts} | 30 ++++----- ...roup-user-list.ts => group-member-list.ts} | 12 ++-- ...r-set.spec.ts => group-member-set.spec.ts} | 6 +- ...{group-user-set.ts => group-member-set.ts} | 12 ++-- 15 files changed, 200 insertions(+), 189 deletions(-) create mode 100644 docs/docs/cmd/entra/group/group-member-add.mdx rename docs/docs/cmd/entra/group/{group-user-list.mdx => group-member-list.mdx} (70%) create mode 100644 docs/docs/cmd/entra/group/group-member-set.mdx delete mode 100644 docs/docs/cmd/entra/group/group-user-add.mdx delete mode 100644 docs/docs/cmd/entra/group/group-user-set.mdx rename src/m365/entra/commands/group/{group-user-add.spec.ts => group-member-add.spec.ts} (98%) rename src/m365/entra/commands/group/{group-user-add.ts => group-member-add.ts} (93%) rename src/m365/entra/commands/group/{group-user-list.spec.ts => group-member-list.spec.ts} (89%) rename src/m365/entra/commands/group/{group-user-list.ts => group-member-list.ts} (95%) rename src/m365/entra/commands/group/{group-user-set.spec.ts => group-member-set.spec.ts} (99%) rename src/m365/entra/commands/group/{group-user-set.ts => group-member-set.ts} (94%) diff --git a/docs/docs/about/release-notes.mdx b/docs/docs/about/release-notes.mdx index 1462590e79a..4c3bc2af27d 100644 --- a/docs/docs/about/release-notes.mdx +++ b/docs/docs/about/release-notes.mdx @@ -211,7 +211,7 @@ sidebar_position: 3 **Entra ID:** -- [entra group user set](../cmd/entra/group/group-user-set.mdx) - updates role of users in an Entra group [#5473](https://github.com/pnp/cli-microsoft365/issues/5473) +- [entra group user set](../cmd/entra/group/group-member-set.mdx) - updates role of users in an Entra group [#5473](https://github.com/pnp/cli-microsoft365/issues/5473) - [entra user groupmembership list](../cmd/entra/user/user-groupmembership-list.mdx) - retrieves all groups where the user is a member of [#5904](https://github.com/pnp/cli-microsoft365/issues/5904) **Global:** @@ -344,7 +344,7 @@ sidebar_position: 3 - [entra administrativeunit member remove](../cmd/entra/administrativeunit/administrativeunit-member-remove.mdx) - removes a member (user, group, or device) from an administrative unit [#5734](https://github.com/pnp/cli-microsoft365/issues/5734) - [entra app permission list](../cmd/entra/app/app-permission-list.mdx) - lists the application and delegated permissions for a specified Entra Application Registration [#5668](https://github.com/pnp/cli-microsoft365/issues/5668) -- [entra group user add](../cmd/entra/group/group-user-add.mdx) - adds a user to a Microsoft Entra ID group [#5471](https://github.com/pnp/cli-microsoft365/issues/5471) +- [entra group user add](../cmd/entra/group/group-member-add.mdx) - adds a user to a Microsoft Entra ID group [#5471](https://github.com/pnp/cli-microsoft365/issues/5471) - [entra group add](../cmd/entra/group/group-add.mdx) - creates a Microsoft Entra group [#5476](https://github.com/pnp/cli-microsoft365/issues/5476) - [entra user registrationdetails list](../cmd/entra/user/user-registrationdetails-list.mdx) - retrieves a list of the authentication methods registered for users [#5773](https://github.com/pnp/cli-microsoft365/issues/5773) @@ -502,7 +502,7 @@ sidebar_position: 3 **Entra ID** -- [entra group user list](../cmd/entra/group/group-user-list.mdx) - lists users of a specific Entra group [#5469](https://github.com/pnp/cli-microsoft365/issues/5469) +- [entra group user list](../cmd/entra/group/group-member-list.mdx) - lists users of a specific Entra group [#5469](https://github.com/pnp/cli-microsoft365/issues/5469) ### Changes diff --git a/docs/docs/cmd/entra/group/group-member-add.mdx b/docs/docs/cmd/entra/group/group-member-add.mdx new file mode 100644 index 00000000000..59d17a13ad1 --- /dev/null +++ b/docs/docs/cmd/entra/group/group-member-add.mdx @@ -0,0 +1,62 @@ +import Global from '/docs/cmd/_global.mdx'; + +# entra group member add + +Adds a member to a Microsoft Entra ID group + +## Usage + +```sh +m365 entra group member add [options] +``` + +## Options + +```md definition-list +`-i, --groupId [groupId]` +: The ID of the Microsoft Entra group. Specify `groupId` or `groupDisplayName` but not both. + +`-n, --groupDisplayName [groupDisplayName]` +: The display name of the Microsoft Entra group. Specify `groupId` or `groupDisplayName` but not both. + +`--ids [ids]` +: Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids` or `userNames` but not both. + +`--userNames [userNames]` +: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both. + +`-r, --role ` +: The role to be assigned to the new users. Valid values: `Owner`, `Member`. +``` + + + +## Examples + +Add a single member specified by ID as a member to a group specified by display name. + +```sh +m365 entra group member add --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member +``` + +Add multiple members specified by ID as members to a group specified by ID. + +```sh +m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member +``` + +Add a single member specified by UPN as an owner to a group specified by display name. + +```sh +m365 entra group member add --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner +``` + +Adds multiple members specified by UPN as owners to a group specified by ID. + +```sh +m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "john.doe@contoso.com,adele.vance@contoso.com" --role Owner +``` + +## Response + +The command won't return a response on success. diff --git a/docs/docs/cmd/entra/group/group-user-list.mdx b/docs/docs/cmd/entra/group/group-member-list.mdx similarity index 70% rename from docs/docs/cmd/entra/group/group-user-list.mdx rename to docs/docs/cmd/entra/group/group-member-list.mdx index 6d87aee976f..65dd320dad0 100644 --- a/docs/docs/cmd/entra/group/group-user-list.mdx +++ b/docs/docs/cmd/entra/group/group-member-list.mdx @@ -2,14 +2,14 @@ import Global from '/docs/cmd/_global.mdx'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# entra group user list +# entra group member list -Lists users of a specific Entra group +Lists members of a specific Entra group ## Usage ```sh -m365 entra group user list [options] +m365 entra group member list [options] ``` ## Alias @@ -28,13 +28,13 @@ m365 aad group user list [options] : The display name of the Entra group. Specify `groupId` or `groupName` but not both. `-r, --role [role]` -: Filter the results to only users with the given role: `Owner`, `Member`. +: Filter the results to only members with the given role: `Owner`, `Member`. `-p, --properties [properties]` : Comma-separated list of properties to retrieve. `-f, --filter [filter]` -: OData filter to use to query the list of users with. +: OData filter to use to query the list of members with. ``` @@ -45,34 +45,34 @@ When the `properties` option includes values with a `/`, for example: `manager/d ## Examples -List all group users from a group specified by ID. +List all group members from a group specified by ID. ```sh -m365 entra group user list --groupId 03cba9da-3974-46c1-afaf-79caa2e45bbe +m365 entra group member list --groupId 03cba9da-3974-46c1-afaf-79caa2e45bbe ``` List all owners from a group specified by display name. ```sh -m365 entra group user list --groupName Developers --role Owner +m365 entra group member list --groupName Developers --role Owner ``` -List all group users from a group specified by name. For each one return the display name, e-mail address, and manager display name. +List all group members from a group specified by name. For each one return the display name, e-mail address, and manager display name. ```sh -m365 entra group user list --groupName Developers --properties "displayName,mail,manager/displayName" +m365 entra group member list --groupName Developers --properties "displayName,mail,manager/displayName" ``` -List all group users from a group specified by name. For each one return the display name, e-mail address, and manager information. +List all group members from a group specified by name. For each one return the display name, e-mail address, and manager information. ```sh -m365 entra group user list --groupName Developers --properties "displayName,mail,manager/*" +m365 entra group member list --groupName Developers --properties "displayName,mail,manager/*" ``` -List all group members that are guest users. +List all group members that are guest members. ```sh -m365 entra group user list --groupName Developers --filter "userType eq 'Guest'" +m365 entra group member list --groupName Developers --filter "userType eq 'Guest'" ``` ## Response diff --git a/docs/docs/cmd/entra/group/group-member-set.mdx b/docs/docs/cmd/entra/group/group-member-set.mdx new file mode 100644 index 00000000000..51b996c841e --- /dev/null +++ b/docs/docs/cmd/entra/group/group-member-set.mdx @@ -0,0 +1,62 @@ +import Global from '/docs/cmd/_global.mdx'; + +# entra group member set + +Updates role of members in a Microsoft Entra ID group + +## Usage + +```sh +m365 entra group member set [options] +``` + +## Options + +```md definition-list +`-i, --groupId [groupId]` +: The ID of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both. + +`-n, --groupDisplayName [groupDisplayName]` +: The display name of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both. + +`--ids [ids]` +: Comma-separated list of user IDs. Specify either `ids` or `userNames` but not both. + +`--userNames [userNames]` +: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both. + +`-r, --role ` +: The new role to be assigned to the members. Valid values: `Owner`, `Member`. +``` + + + +## Examples + +Update a single member specified by ID to a member of a group specified by display name + +```sh +m365 entra group member set --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member +``` + +Update multiple members specified by ID to members of a group specified by ID + +```sh +m365 entra group member set --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member +``` + +Update a single member specified by UPN to an owner of a group specified by display name + +```sh +m365 entra group member set --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner +``` + +Update multiple members specified by UPN to owners of a group specified by ID + +```sh +m365 entra group member set --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "john.doe@contoso.com,adele.vance@contoso.com" --role Owner +``` + +## Response + +The command won't return a response on success. diff --git a/docs/docs/cmd/entra/group/group-user-add.mdx b/docs/docs/cmd/entra/group/group-user-add.mdx deleted file mode 100644 index c220b3c9f1d..00000000000 --- a/docs/docs/cmd/entra/group/group-user-add.mdx +++ /dev/null @@ -1,62 +0,0 @@ -import Global from '/docs/cmd/_global.mdx'; - -# entra group user add - -Adds a user to a Microsoft Entra ID group - -## Usage - -```sh -m365 entra group user add [options] -``` - -## Options - -```md definition-list -`-i, --groupId [groupId]` -: The ID of the Microsoft Entra group. Specify `groupId` or `groupDisplayName` but not both. - -`-n, --groupDisplayName [groupDisplayName]` -: The display name of the Microsoft Entra group. Specify `groupId` or `groupDisplayName` but not both. - -`--ids [ids]` -: Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids` or `userNames` but not both. - -`--userNames [userNames]` -: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both. - -`-r, --role ` -: The role to be assigned to the new users. Valid values: `Owner`, `Member`. -``` - - - -## Examples - -Add a single user specified by ID as a member to a group specified by display name. - -```sh -m365 entra group user add --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member -``` - -Add multiple users specified by ID as members to a group specified by ID. - -```sh -m365 entra group user add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member -``` - -Add a single user specified by UPN as an owner to a group specified by display name. - -```sh -m365 entra group user add --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner -``` - -Adds multiple users specified by UPN as owners to a group specified by ID. - -```sh -m365 entra group user add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "john.doe@contoso.com,adele.vance@contoso.com" --role Owner -``` - -## Response - -The command won't return a response on success. diff --git a/docs/docs/cmd/entra/group/group-user-set.mdx b/docs/docs/cmd/entra/group/group-user-set.mdx deleted file mode 100644 index 1ebeb1b527c..00000000000 --- a/docs/docs/cmd/entra/group/group-user-set.mdx +++ /dev/null @@ -1,62 +0,0 @@ -import Global from '/docs/cmd/_global.mdx'; - -# entra group user set - -Updates role of users in a Microsoft Entra ID group - -## Usage - -```sh -m365 entra group user set [options] -``` - -## Options - -```md definition-list -`-i, --groupId [groupId]` -: The ID of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both. - -`-n, --groupDisplayName [groupDisplayName]` -: The display name of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both. - -`--ids [ids]` -: Comma-separated list of user IDs. Specify either `ids` or `userNames` but not both. - -`--userNames [userNames]` -: The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both. - -`-r, --role ` -: The new role to be assigned to the users. Valid values: `Owner`, `Member`. -``` - - - -## Examples - -Update a single user specified by ID to a member of a group specified by display name - -```sh -m365 entra group user set --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member -``` - -Update multiple users specified by ID to members of a group specified by ID - -```sh -m365 entra group user set --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member -``` - -Update a single user specified by UPN to an owner of a group specified by display name - -```sh -m365 entra group user set --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner -``` - -Update multiple users specified by UPN to owners of a group specified by ID - -```sh -m365 entra group user set --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "john.doe@contoso.com,adele.vance@contoso.com" --role Owner -``` - -## Response - -The command won't return a response on success. diff --git a/docs/docs/v10-upgrade-guidance.mdx b/docs/docs/v10-upgrade-guidance.mdx index aa3893aa47b..5a9e83c9b45 100644 --- a/docs/docs/v10-upgrade-guidance.mdx +++ b/docs/docs/v10-upgrade-guidance.mdx @@ -76,7 +76,7 @@ We updated option naming from `groupDisplayName` to `groupName` and `userPrincip **Affected commands:** -- [entra group user list](./cmd/entra/group/group-user-list.mdx) +- [entra group member list](./cmd/entra/group/group-member-list.mdx) - [entra m365group conversation post list](./cmd/entra/m365group/m365group-conversation-post-list.mdx) - [entra m365group recyclebinitem list](./cmd/entra/m365group/m365group-recyclebinitem-list.mdx) - [outlook message get](./cmd/outlook/message/message-get.mdx) @@ -130,6 +130,17 @@ We've enhanced the [entra m365group set](./cmd/entra/m365group/m365group-set.mdx Make sure that if you are currently updating groups using the `displayName` option, you update your scripts to use the `newDisplayName` option instead. +### Renamed `entra group user` commands to `entra group member` + +We have renamed the `entra group user` commands to `entra group member` to better reflect the command's purpose,. The following commands were renamed: +- [entra group member add](./cmd/entra/group/group-member-add.mdx) +- [entra group member list](./cmd/entra/group/group-member-list.mdx) +- [entra group member set](./cmd/entra/group/group-member-set.mdx) + +#### What action do I need to take? + +Please update your scripts to use the new command names. + ## SharePoint ### Updated `spo site appcatalog remove` options diff --git a/docs/src/config/sidebars.ts b/docs/src/config/sidebars.ts index 929281df705..0370e28df09 100644 --- a/docs/src/config/sidebars.ts +++ b/docs/src/config/sidebars.ts @@ -365,18 +365,18 @@ const sidebars: SidebarsConfig = { }, { type: 'doc', - label: 'group user add', - id: 'cmd/entra/group/group-user-add' + label: 'group member add', + id: 'cmd/entra/group/group-member-add' }, { type: 'doc', - label: 'group user list', - id: 'cmd/entra/group/group-user-list' + label: 'group member list', + id: 'cmd/entra/group/group-member-list' }, { type: 'doc', - label: 'group user set', - id: 'cmd/entra/group/group-user-set' + label: 'group member set', + id: 'cmd/entra/group/group-member-set' } ] }, diff --git a/src/m365/entra/commands.ts b/src/m365/entra/commands.ts index 3162a130868..4b51b5d02e4 100644 --- a/src/m365/entra/commands.ts +++ b/src/m365/entra/commands.ts @@ -42,9 +42,9 @@ export default { GROUP_LIST: `${prefix} group list`, GROUP_REMOVE: `${prefix} group remove`, GROUP_SET: `${prefix} group set`, - GROUP_USER_ADD: `${prefix} group user add`, - GROUP_USER_LIST: `${prefix} group user list`, - GROUP_USER_SET: `${prefix} group user set`, + GROUP_MEMBER_ADD: `${prefix} group member add`, + GROUP_MEMBER_LIST: `${prefix} group member list`, + GROUP_MEMBER_SET: `${prefix} group member set`, GROUPSETTING_ADD: `${prefix} groupsetting add`, GROUPSETTING_GET: `${prefix} groupsetting get`, GROUPSETTING_LIST: `${prefix} groupsetting list`, diff --git a/src/m365/entra/commands/group/group-user-add.spec.ts b/src/m365/entra/commands/group/group-member-add.spec.ts similarity index 98% rename from src/m365/entra/commands/group/group-user-add.spec.ts rename to src/m365/entra/commands/group/group-member-add.spec.ts index 836d72c3538..2c0d9edc246 100644 --- a/src/m365/entra/commands/group/group-user-add.spec.ts +++ b/src/m365/entra/commands/group/group-member-add.spec.ts @@ -9,13 +9,13 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import { cli } from '../../../../cli/cli.js'; import { CommandInfo } from '../../../../cli/CommandInfo.js'; -import command from './group-user-add.js'; +import command from './group-member-add.js'; import request from '../../../../request.js'; import { entraGroup } from '../../../../utils/entraGroup.js'; import { entraUser } from '../../../../utils/entraUser.js'; import { CommandError } from '../../../../Command.js'; -describe(commands.GROUP_USER_ADD, () => { +describe(commands.GROUP_MEMBER_ADD, () => { const groupId = '630dfae3-6904-4154-acc2-812e11205351'; const userUpns = ['user1@contoso.com', 'user2@contoso.com', 'user3@contoso.com', 'user4@contoso.com', 'user5@contoso.com', 'user6@contoso.com', 'user7@contoso.com', 'user8@contoso.com', 'user9@contoso.com', 'user10@contoso.com', 'user11@contoso.com', 'user12@contoso.com', 'user13@contoso.com', 'user14@contoso.com', 'user15@contoso.com', 'user16@contoso.com', 'user17@contoso.com', 'user18@contoso.com', 'user19@contoso.com', 'user20@contoso.com', 'user21@contoso.com', 'user22@contoso.com', 'user23@contoso.com', 'user24@contoso.com', 'user25@contoso.com']; const userIds = ['3f2504e0-4f89-11d3-9a0c-0305e82c3301', '6dcd4ce0-4f89-11d3-9a0c-0305e82c3302', '9b76f130-4f89-11d3-9a0c-0305e82c3303', 'c835f5e0-4f89-11d3-9a0c-0305e82c3304', 'f4f3fa90-4f89-11d3-9a0c-0305e82c3305', '2230f6a0-4f8a-11d3-9a0c-0305e82c3306', '4f6df5b0-4f8a-11d3-9a0c-0305e82c3307', '7caaf4c0-4f8a-11d3-9a0c-0305e82c3308', 'a9e8f3d0-4f8a-11d3-9a0c-0305e82c3309', 'd726f2e0-4f8a-11d3-9a0c-0305e82c330a', '0484f1f0-4f8b-11d3-9a0c-0305e82c330b', '31e2f100-4f8b-11d3-9a0c-0305e82c330c', '5f40f010-4f8b-11d3-9a0c-0305e82c330d', '8c9eef20-4f8b-11d3-9a0c-0305e82c330e', 'b9fce030-4f8b-11d3-9a0c-0305e82c330f', 'e73cdf40-4f8b-11d3-9a0c-0305e82c3310', '1470ce50-4f8c-11d3-9a0c-0305e82c3311', '41a3cd60-4f8c-11d3-9a0c-0305e82c3312', '6ed6cc70-4f8c-11d3-9a0c-0305e82c3313', '9c09cb80-4f8c-11d3-9a0c-0305e82c3314', 'c93cca90-4f8c-11d3-9a0c-0305e82c3315', 'f66cc9a0-4f8c-11d3-9a0c-0305e82c3316', '2368c8b0-4f8d-11d3-9a0c-0305e82c3317', '5064c7c0-4f8d-11d3-9a0c-0305e82c3318', '7d60c6d0-4f8d-11d3-9a0c-0305e82c3319']; @@ -62,7 +62,7 @@ describe(commands.GROUP_USER_ADD, () => { }); it('has correct name', () => { - assert.strictEqual(command.name, commands.GROUP_USER_ADD); + assert.strictEqual(command.name, commands.GROUP_MEMBER_ADD); }); it('has a description', () => { diff --git a/src/m365/entra/commands/group/group-user-add.ts b/src/m365/entra/commands/group/group-member-add.ts similarity index 93% rename from src/m365/entra/commands/group/group-user-add.ts rename to src/m365/entra/commands/group/group-member-add.ts index 4965ff4114d..8e515bc077b 100644 --- a/src/m365/entra/commands/group/group-user-add.ts +++ b/src/m365/entra/commands/group/group-member-add.ts @@ -19,15 +19,15 @@ interface Options extends GlobalOptions { role: string; } -class EntraGroupUserAddCommand extends GraphCommand { +class EntraGroupMemberAddCommand extends GraphCommand { private readonly roleValues = ['Owner', 'Member']; public get name(): string { - return commands.GROUP_USER_ADD; + return commands.GROUP_MEMBER_ADD; } public get description(): string { - return 'Adds a user to a Microsoft Entra ID group'; + return 'Adds a member to a Microsoft Entra ID group'; } constructor() { @@ -116,7 +116,7 @@ class EntraGroupUserAddCommand extends GraphCommand { public async commandAction(logger: Logger, args: CommandArgs): Promise { try { if (this.verbose) { - await logger.logToStderr(`Adding user(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName}...`); + await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName}...`); } const groupId = await this.getGroupId(logger, args.options); @@ -188,4 +188,4 @@ class EntraGroupUserAddCommand extends GraphCommand { } } -export default new EntraGroupUserAddCommand(); \ No newline at end of file +export default new EntraGroupMemberAddCommand(); \ No newline at end of file diff --git a/src/m365/entra/commands/group/group-user-list.spec.ts b/src/m365/entra/commands/group/group-member-list.spec.ts similarity index 89% rename from src/m365/entra/commands/group/group-user-list.spec.ts rename to src/m365/entra/commands/group/group-member-list.spec.ts index ff6ff99ef10..78eea44d419 100644 --- a/src/m365/entra/commands/group/group-user-list.spec.ts +++ b/src/m365/entra/commands/group/group-member-list.spec.ts @@ -14,10 +14,10 @@ import { sinonUtil } from '../../../../utils/sinonUtil.js'; import { settingsNames } from '../../../../settingsNames.js'; import { formatting } from '../../../../utils/formatting.js'; import commands from '../../commands.js'; -import command from './group-user-list.js'; +import command from './group-member-list.js'; import aadCommands from '../../aadCommands.js'; -describe(commands.GROUP_USER_LIST, () => { +describe(commands.GROUP_MEMBER_LIST, () => { const groupId = '2c1ba4c4-cd9b-4417-832f-92a34bc34b2a'; const groupName = 'CLI Test Group'; @@ -67,7 +67,7 @@ describe(commands.GROUP_USER_LIST, () => { }); it('has correct name', () => { - assert.strictEqual(command.name, commands.GROUP_USER_LIST); + assert.strictEqual(command.name, commands.GROUP_MEMBER_LIST); }); it('has a description', () => { @@ -118,13 +118,13 @@ describe(commands.GROUP_USER_LIST, () => { it('correctly lists all users in a Microsoft Entra group by id', async () => { sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [{ "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }] }; } - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [ { "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }, @@ -162,13 +162,13 @@ describe(commands.GROUP_USER_LIST, () => { sinon.stub(entraGroup, 'getGroupIdByDisplayName').resolves(groupId); sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [{ "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }] }; } - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [ { "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }, @@ -204,7 +204,7 @@ describe(commands.GROUP_USER_LIST, () => { it('correctly lists all owners in a Microsoft Entra group', async () => { sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [{ "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }] }; @@ -265,7 +265,7 @@ describe(commands.GROUP_USER_LIST, () => { }; } - if (opts.url === `https://graph.microsoft.com/v1.0/groups/9b1b1e42-794b-4c71-93ac-5ed92488b67f/Owners/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/9b1b1e42-794b-4c71-93ac-5ed92488b67f/Owners?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [{ "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }] }; @@ -291,7 +291,7 @@ describe(commands.GROUP_USER_LIST, () => { it('correctly lists all members in a Microsoft Entra group', async () => { sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members?$select=id,displayName,userPrincipalName,givenName,surname`) { return { "value": [ { "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "anne.matthews@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" }, @@ -327,7 +327,7 @@ describe(commands.GROUP_USER_LIST, () => { it('correctly lists properties for all users in a Microsoft Entra group', async () => { sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners/microsoft.graph.user?$select=displayName,mail,id&$expand=memberof($select=id),memberof($select=displayName)`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners?$select=displayName,mail,id&$expand=memberof($select=id),memberof($select=displayName)`) { return { "value": [ { "id": "00000000-0000-0000-0000-000000000000", "displayName": "Karl Matteson", "mail": "karl.matteson@contoso.onmicrosoft.com", "memberOf": [{ "displayName": "Life and Music", "id": "d6c88284-c598-468d-8074-56acaf3c0453" }] } @@ -335,7 +335,7 @@ describe(commands.GROUP_USER_LIST, () => { }; } - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members/microsoft.graph.user?$select=displayName,mail,id&$expand=memberof($select=id),memberof($select=displayName)`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members?$select=displayName,mail,id&$expand=memberof($select=id),memberof($select=displayName)`) { return { "value": [ { "id": "00000000-0000-0000-0000-000000000001", "displayName": "Anne Matthews", "mail": "anne.matthews@contoso.onmicrosoft.com", "memberOf": [{ "displayName": "Life and Music", "id": "d6c88284-c598-468d-8074-56acaf3c0454" }] } @@ -356,13 +356,13 @@ describe(commands.GROUP_USER_LIST, () => { it('correctly lists all guest users in a Microsoft Entra group', async () => { sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true`) { return { "value": [] }; } - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Members?$select=id,displayName,userPrincipalName,givenName,surname&$filter=userType%20eq%20'Guest'&$count=true`) { return { "value": [ { "id": "00000000-0000-0000-0000-000000000000", "displayName": "Anne Matthews", "userPrincipalName": "annematthews_gmail.com#EXT#@contoso.onmicrosoft.com", "givenName": "Anne", "surname": "Matthews" } @@ -401,7 +401,7 @@ describe(commands.GROUP_USER_LIST, () => { }; sinon.stub(request, 'get').callsFake(async (opts) => { - if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners/microsoft.graph.user?$select=id,displayName,userPrincipalName,givenName,surname`) { + if (opts.url === `https://graph.microsoft.com/v1.0/groups/2c1ba4c4-cd9b-4417-832f-92a34bc34b2a/Owners?$select=id,displayName,userPrincipalName,givenName,surname`) { throw error; } diff --git a/src/m365/entra/commands/group/group-user-list.ts b/src/m365/entra/commands/group/group-member-list.ts similarity index 95% rename from src/m365/entra/commands/group/group-user-list.ts rename to src/m365/entra/commands/group/group-member-list.ts index e6fb34b5c5f..cca4061b1c3 100644 --- a/src/m365/entra/commands/group/group-user-list.ts +++ b/src/m365/entra/commands/group/group-member-list.ts @@ -25,13 +25,13 @@ interface ExtendedUser extends User { roles: string[]; } -class EntraGroupUserListCommand extends GraphCommand { +class EntraGroupMemberListCommand extends GraphCommand { public get name(): string { - return commands.GROUP_USER_LIST; + return commands.GROUP_MEMBER_LIST; } public get description(): string { - return 'Lists users of a specific Entra group'; + return 'Lists members of a specific Entra group'; } public alias(): string[] | undefined { @@ -111,7 +111,7 @@ class EntraGroupUserListCommand extends GraphCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, aadCommands.GROUP_USER_LIST, commands.GROUP_USER_LIST); + await this.showDeprecationWarning(logger, aadCommands.GROUP_USER_LIST, commands.GROUP_MEMBER_LIST); try { const groupId = await this.getGroupId(args.options, logger); @@ -181,7 +181,7 @@ class EntraGroupUserListCommand extends GraphCommand { const expandParam = fieldExpand.length > 0 ? `&$expand=${fieldExpand}` : ''; const selectParam = allSelectProperties.filter(item => !item.includes('/')); - const endpoint: string = `${this.resource}/v1.0/groups/${groupId}/${role}/microsoft.graph.user?$select=${selectParam}${expandParam}`; + const endpoint: string = `${this.resource}/v1.0/groups/${groupId}/${role}?$select=${selectParam}${expandParam}`; let users: ExtendedUser[] = []; @@ -207,4 +207,4 @@ class EntraGroupUserListCommand extends GraphCommand { } } -export default new EntraGroupUserListCommand(); \ No newline at end of file +export default new EntraGroupMemberListCommand(); \ No newline at end of file diff --git a/src/m365/entra/commands/group/group-user-set.spec.ts b/src/m365/entra/commands/group/group-member-set.spec.ts similarity index 99% rename from src/m365/entra/commands/group/group-user-set.spec.ts rename to src/m365/entra/commands/group/group-member-set.spec.ts index 994af7d2dee..9dd8b19b92b 100644 --- a/src/m365/entra/commands/group/group-user-set.spec.ts +++ b/src/m365/entra/commands/group/group-member-set.spec.ts @@ -9,13 +9,13 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import { cli } from '../../../../cli/cli.js'; import { CommandInfo } from '../../../../cli/CommandInfo.js'; -import command from './group-user-set.js'; +import command from './group-member-set.js'; import request from '../../../../request.js'; import { entraGroup } from '../../../../utils/entraGroup.js'; import { entraUser } from '../../../../utils/entraUser.js'; import { CommandError } from '../../../../Command.js'; -describe(commands.GROUP_USER_ADD, () => { +describe(commands.GROUP_MEMBER_SET, () => { const groupId = '630dfae3-6904-4154-acc2-812e11205351'; const userUpns = ['user1@contoso.com', 'user2@contoso.com', 'user3@contoso.com', 'user4@contoso.com', 'user5@contoso.com', 'user6@contoso.com', 'user7@contoso.com', 'user8@contoso.com', 'user9@contoso.com', 'user10@contoso.com', 'user11@contoso.com', 'user12@contoso.com', 'user13@contoso.com', 'user14@contoso.com', 'user15@contoso.com', 'user16@contoso.com', 'user17@contoso.com', 'user18@contoso.com', 'user19@contoso.com', 'user20@contoso.com', 'user21@contoso.com', 'user22@contoso.com', 'user23@contoso.com', 'user24@contoso.com', 'user25@contoso.com']; const userIds = ['3f2504e0-4f89-11d3-9a0c-0305e82c3301', '6dcd4ce0-4f89-11d3-9a0c-0305e82c3302', '9b76f130-4f89-11d3-9a0c-0305e82c3303', 'c835f5e0-4f89-11d3-9a0c-0305e82c3304', 'f4f3fa90-4f89-11d3-9a0c-0305e82c3305', '2230f6a0-4f8a-11d3-9a0c-0305e82c3306', '4f6df5b0-4f8a-11d3-9a0c-0305e82c3307', '7caaf4c0-4f8a-11d3-9a0c-0305e82c3308', 'a9e8f3d0-4f8a-11d3-9a0c-0305e82c3309', 'd726f2e0-4f8a-11d3-9a0c-0305e82c330a', '0484f1f0-4f8b-11d3-9a0c-0305e82c330b', '31e2f100-4f8b-11d3-9a0c-0305e82c330c', '5f40f010-4f8b-11d3-9a0c-0305e82c330d', '8c9eef20-4f8b-11d3-9a0c-0305e82c330e', 'b9fce030-4f8b-11d3-9a0c-0305e82c330f', 'e73cdf40-4f8b-11d3-9a0c-0305e82c3310', '1470ce50-4f8c-11d3-9a0c-0305e82c3311', '41a3cd60-4f8c-11d3-9a0c-0305e82c3312', '6ed6cc70-4f8c-11d3-9a0c-0305e82c3313', '9c09cb80-4f8c-11d3-9a0c-0305e82c3314', 'c93cca90-4f8c-11d3-9a0c-0305e82c3315', 'f66cc9a0-4f8c-11d3-9a0c-0305e82c3316', '2368c8b0-4f8d-11d3-9a0c-0305e82c3317', '5064c7c0-4f8d-11d3-9a0c-0305e82c3318', '7d60c6d0-4f8d-11d3-9a0c-0305e82c3319']; @@ -62,7 +62,7 @@ describe(commands.GROUP_USER_ADD, () => { }); it('has correct name', () => { - assert.strictEqual(command.name, commands.GROUP_USER_SET); + assert.strictEqual(command.name, commands.GROUP_MEMBER_SET); }); it('has a description', () => { diff --git a/src/m365/entra/commands/group/group-user-set.ts b/src/m365/entra/commands/group/group-member-set.ts similarity index 94% rename from src/m365/entra/commands/group/group-user-set.ts rename to src/m365/entra/commands/group/group-member-set.ts index 1a1fa899e26..7c9fca02fc5 100644 --- a/src/m365/entra/commands/group/group-user-set.ts +++ b/src/m365/entra/commands/group/group-member-set.ts @@ -19,15 +19,15 @@ interface Options extends GlobalOptions { role: string; } -class EntraGroupUserSetCommand extends GraphCommand { +class EntraGroupMemberSetCommand extends GraphCommand { private readonly roleValues = ['Owner', 'Member']; public get name(): string { - return commands.GROUP_USER_SET; + return commands.GROUP_MEMBER_SET; } public get description(): string { - return 'Updates role of users in a Microsoft Entra ID group'; + return 'Updates role of members in a Microsoft Entra ID group'; } constructor() { @@ -116,7 +116,7 @@ class EntraGroupUserSetCommand extends GraphCommand { public async commandAction(logger: Logger, args: CommandArgs): Promise { try { if (this.verbose) { - await logger.logToStderr(`Adding user(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName}...`); + await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName}...`); } const groupId = await this.getGroupId(logger, args.options); @@ -163,7 +163,7 @@ class EntraGroupUserSetCommand extends GraphCommand { const currentRole = options.role === 'Member' ? 'owners' : 'members'; if (this.verbose) { - await logger.logToStderr(`Removing users from the old role '${currentRole}'.`); + await logger.logToStderr(`Removing members from the old role '${currentRole}'.`); } for (let i = 0; i < userIds.length; i += 20) { @@ -262,4 +262,4 @@ class EntraGroupUserSetCommand extends GraphCommand { } } -export default new EntraGroupUserSetCommand(); \ No newline at end of file +export default new EntraGroupMemberSetCommand(); \ No newline at end of file From f303712261d799239bcbe09c6411b0dd6346113f Mon Sep 17 00:00:00 2001 From: Martin Lingstuyl Date: Fri, 4 Oct 2024 13:04:55 +0200 Subject: [PATCH 2/3] Update src/m365/entra/commands/group/group-member-set.ts --- src/m365/entra/commands/group/group-member-set.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m365/entra/commands/group/group-member-set.ts b/src/m365/entra/commands/group/group-member-set.ts index 7c9fca02fc5..c64d5908ccf 100644 --- a/src/m365/entra/commands/group/group-member-set.ts +++ b/src/m365/entra/commands/group/group-member-set.ts @@ -27,7 +27,7 @@ class EntraGroupMemberSetCommand extends GraphCommand { } public get description(): string { - return 'Updates role of members in a Microsoft Entra ID group'; + return 'Updates the role of members in a Microsoft Entra ID group'; } constructor() { From 2c2ac2aef891e0a5db133bea776ff76e998237b4 Mon Sep 17 00:00:00 2001 From: Martin Lingstuyl Date: Fri, 4 Oct 2024 13:05:01 +0200 Subject: [PATCH 3/3] Update src/m365/entra/commands/group/group-member-set.ts --- src/m365/entra/commands/group/group-member-set.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m365/entra/commands/group/group-member-set.ts b/src/m365/entra/commands/group/group-member-set.ts index c64d5908ccf..1e48474e98e 100644 --- a/src/m365/entra/commands/group/group-member-set.ts +++ b/src/m365/entra/commands/group/group-member-set.ts @@ -116,7 +116,7 @@ class EntraGroupMemberSetCommand extends GraphCommand { public async commandAction(logger: Logger, args: CommandArgs): Promise { try { if (this.verbose) { - await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName}...`); + await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to role ${args.options.role} of group ${args.options.groupId || args.options.groupDisplayName}...`); } const groupId = await this.getGroupId(logger, args.options);