@pnp/cli-microsoft365 7.0.0-beta.093ef31 → 7.0.0-beta.18ce559
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/Auth.js +10 -1
- package/dist/Command.js +2 -2
- package/dist/cli/Cli.js +4 -4
- package/dist/m365/aad/commands/app/app-get.js +4 -1
- package/dist/m365/aad/commands/app/app-remove.js +3 -1
- package/dist/m365/aad/commands/app/app-role-add.js +4 -1
- package/dist/m365/aad/commands/app/app-role-list.js +4 -1
- package/dist/m365/aad/commands/app/app-role-remove.js +5 -2
- package/dist/m365/aad/commands/app/app-set.js +8 -5
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +11 -6
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +4 -4
- package/dist/m365/aad/commands/group/group-get.js +4 -4
- package/dist/m365/aad/commands/group/group-list.js +1 -23
- package/dist/m365/aad/commands/group/group-remove.js +98 -0
- package/dist/m365/aad/commands/m365group/m365group-add.js +21 -12
- package/dist/m365/aad/commands/m365group/m365group-conversation-list.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-conversation-post-list.js +4 -0
- package/dist/m365/aad/commands/m365group/m365group-get.js +4 -3
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +3 -1
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-restore.js +4 -1
- package/dist/m365/aad/commands/m365group/m365group-remove.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-renew.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-set.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-teamify.js +14 -6
- package/dist/m365/aad/commands/m365group/m365group-user-add.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-list.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-remove.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-set.js +5 -0
- package/dist/m365/aad/commands/sp/sp-add.js +4 -1
- package/dist/m365/aad/commands/sp/sp-get.js +4 -1
- package/dist/m365/aad/commands/user/user-get.js +7 -2
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/booking/commands/business/business-get.js +4 -1
- package/dist/m365/commands/login.js +2 -2
- package/dist/m365/flow/commands/flow-export.js +13 -13
- package/dist/m365/graph/commands/subscription/subscription-add.js +5 -5
- package/dist/m365/outlook/commands/message/message-list.js +4 -2
- package/dist/m365/outlook/commands/message/message-move.js +4 -2
- package/dist/m365/pa/commands/app/app-export.js +7 -7
- package/dist/m365/pa/commands/connector/connector-export.js +5 -5
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -1
- package/dist/m365/planner/commands/bucket/bucket-get.js +9 -2
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -1
- package/dist/m365/planner/commands/bucket/bucket-remove.js +7 -2
- package/dist/m365/planner/commands/bucket/bucket-set.js +8 -2
- package/dist/m365/planner/commands/plan/plan-add.js +4 -1
- package/dist/m365/planner/commands/plan/plan-get.js +4 -1
- package/dist/m365/planner/commands/plan/plan-list.js +4 -1
- package/dist/m365/planner/commands/plan/plan-remove.js +4 -1
- package/dist/m365/planner/commands/plan/plan-set.js +4 -1
- package/dist/m365/planner/commands/roster/roster-get.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-add.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-get.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-list.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -1
- package/dist/m365/planner/commands/roster/roster-plan-list.js +4 -1
- package/dist/m365/planner/commands/roster/roster-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-add.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-list.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-get.js +11 -3
- package/dist/m365/planner/commands/task/task-list.js +10 -2
- package/dist/m365/planner/commands/task/task-reference-add.js +4 -1
- package/dist/m365/planner/commands/task/task-reference-list.js +4 -1
- package/dist/m365/planner/commands/task/task-reference-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-remove.js +10 -4
- package/dist/m365/planner/commands/task/task-set.js +4 -1
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +4 -1
- package/dist/m365/pp/commands/card/card-get.js +3 -5
- package/dist/m365/pp/commands/chatbot/chatbot-get.js +3 -1
- package/dist/m365/pp/commands/chatbot/chatbot-list.js +2 -2
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +4 -1
- package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.5.js → doctor-1.18.0.js} +2 -2
- package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001022_DEP_office_ui_fabric_react.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002028_DEVDEP_microsoft_rush_stack_compiler_4_7.js +13 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.5.js → upgrade-1.18.0.js} +35 -27
- package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
- package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +5 -3
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -2
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +3 -2
- package/dist/m365/spo/commands/commandset/commandset-get.js +4 -2
- package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -1
- package/dist/m365/spo/commands/commandset/commandset-set.js +3 -1
- package/dist/m365/spo/commands/customaction/customaction-get.js +5 -2
- package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -1
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -1
- package/dist/m365/spo/commands/file/file-get.js +11 -8
- package/dist/m365/spo/commands/file/file-remove.js +2 -2
- package/dist/m365/spo/commands/file/file-version-clear.js +2 -2
- package/dist/m365/spo/commands/file/file-version-get.js +2 -2
- package/dist/m365/spo/commands/file/file-version-list.js +2 -2
- package/dist/m365/spo/commands/file/file-version-remove.js +2 -2
- package/dist/m365/spo/commands/file/file-version-restore.js +2 -2
- package/dist/m365/spo/commands/group/group-member-add.js +24 -24
- package/dist/m365/spo/commands/hubsite/hubsite-connect.js +7 -4
- package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +4 -1
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -1
- package/dist/m365/spo/commands/listitem/listitem-add.js +1 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +127 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +97 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +121 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +115 -0
- package/dist/m365/spo/commands/listitem/listitem-set.js +3 -2
- package/dist/m365/spo/commands/page/clientsidepages.js +18 -0
- package/dist/m365/spo/commands/page/page-get.js +1 -0
- package/dist/m365/spo/commands/page/page-list.js +4 -3
- package/dist/m365/spo/commands/page/page-section-add.js +56 -21
- package/dist/m365/spo/commands/page/page-set.js +13 -2
- package/dist/m365/spo/commands/site/site-commsite-enable.js +34 -5
- package/dist/m365/spo/commands/site/site-list.js +5 -7
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +8 -3
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +8 -3
- package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +3 -1
- package/dist/m365/spo/commands/term/term-get.js +6 -6
- package/dist/m365/spo/commands/user/user-get.js +10 -10
- package/dist/m365/spo/commands.js +4 -0
- package/dist/m365/teams/commands/app/app-remove.js +49 -15
- package/dist/m365/teams/commands/channel/channel-add.js +5 -1
- package/dist/m365/teams/commands/channel/channel-member-add.js +12 -10
- package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -1
- package/dist/m365/teams/commands/channel/channel-member-set.js +4 -1
- package/dist/m365/teams/commands/chat/chat-get.js +7 -10
- package/dist/m365/teams/commands/chat/chat-message-send.js +8 -10
- package/dist/m365/teams/commands/team/team-clone.js +5 -10
- package/dist/m365/teams/commands/team/team-list.js +94 -30
- package/dist/m365/tenant/commands/info/info-get.js +83 -0
- package/dist/m365/tenant/commands.js +1 -0
- package/dist/utils/aadGroup.js +21 -3
- package/dist/utils/formatting.js +7 -0
- package/dist/utils/powerPlatform.js +1 -1
- package/docs/docs/_clisettings.mdx +1 -1
- package/docs/docs/cmd/aad/app/app-set.mdx +15 -15
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +9 -9
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +10 -10
- package/docs/docs/cmd/aad/group/group-get.mdx +5 -5
- package/docs/docs/cmd/aad/group/group-list.mdx +0 -11
- package/docs/docs/cmd/aad/group/group-remove.mdx +44 -0
- package/docs/docs/cmd/aad/m365group/m365group-add.mdx +13 -3
- package/docs/docs/cmd/aad/policy/policy-list.mdx +5 -5
- package/docs/docs/cmd/cli/config/config-list.mdx +1 -1
- package/docs/docs/cmd/flow/flow-export.mdx +11 -11
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +10 -10
- package/docs/docs/cmd/pa/app/app-export.mdx +5 -5
- package/docs/docs/cmd/pa/connector/connector-export.mdx +3 -3
- package/docs/docs/cmd/pp/chatbot/chatbot-list.mdx +4 -4
- package/docs/docs/cmd/pp/solution/solution-publisher-get.mdx +2 -2
- package/docs/docs/cmd/pp/solution/solution-publisher-remove.mdx +2 -2
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-list.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +2 -2
- package/docs/docs/cmd/spo/group/group-member-add.mdx +27 -27
- package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-add.mdx +2 -5
- package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +110 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +104 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-set.mdx +2 -5
- package/docs/docs/cmd/spo/page/page-get.mdx +0 -1
- package/docs/docs/cmd/spo/page/page-list.mdx +0 -1
- package/docs/docs/cmd/spo/page/page-section-add.mdx +25 -1
- package/docs/docs/cmd/spo/page/page-set.mdx +23 -0
- package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +11 -2
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +2 -4
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +2 -4
- package/docs/docs/cmd/spo/user/user-get.mdx +8 -8
- package/docs/docs/cmd/teams/app/app-remove.mdx +9 -6
- package/docs/docs/cmd/teams/channel/channel-member-add.mdx +4 -4
- package/docs/docs/cmd/teams/team/team-clone.mdx +3 -3
- package/docs/docs/cmd/teams/team/team-list.mdx +47 -22
- package/docs/docs/cmd/tenant/info/info-get.mdx +101 -0
- package/npm-shrinkwrap.json +24 -24
- package/package.json +8 -12
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
alt="Discord" />
|
|
21
21
|
</a>
|
|
22
22
|
|
|
23
|
-
<a href="https://
|
|
24
|
-
<img src="https://img.shields.io/badge/
|
|
25
|
-
alt="
|
|
23
|
+
<a href="https://x.com/climicrosoft365">
|
|
24
|
+
<img src="https://img.shields.io/badge/X-%40climicrosoft365-blue?style=flat-square"
|
|
25
|
+
alt="X" />
|
|
26
26
|
</a>
|
|
27
27
|
</p>
|
|
28
28
|
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
- Upgrade your projects
|
|
102
102
|
- Check your environment compatibility
|
|
103
103
|
|
|
104
|
-
> Follow our [
|
|
104
|
+
> Follow our [X](https://x.com/climicrosoft365) account to keep yourself updated about new features, improvements, and bug fixes.
|
|
105
105
|
|
|
106
106
|
## Install
|
|
107
107
|
|
package/dist/Auth.js
CHANGED
|
@@ -338,7 +338,16 @@ export class Auth {
|
|
|
338
338
|
await logger.logToStderr(response);
|
|
339
339
|
await logger.logToStderr('');
|
|
340
340
|
}
|
|
341
|
-
|
|
341
|
+
const cli = Cli.getInstance();
|
|
342
|
+
cli.spinner.text = response.message;
|
|
343
|
+
cli.spinner.spinner = {
|
|
344
|
+
frames: ['🌶️ ']
|
|
345
|
+
};
|
|
346
|
+
// don't show spinner if running tests
|
|
347
|
+
/* c8 ignore next 3 */
|
|
348
|
+
if (!cli.spinner.isSpinning && typeof global.it === 'undefined') {
|
|
349
|
+
cli.spinner.start();
|
|
350
|
+
}
|
|
342
351
|
if (Cli.getInstance().getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false)) {
|
|
343
352
|
browserUtil.open(response.verificationUri);
|
|
344
353
|
}
|
package/dist/Command.js
CHANGED
|
@@ -74,7 +74,7 @@ class Command {
|
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
async validateRequiredOptions(args, command) {
|
|
77
|
-
const shouldPrompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt,
|
|
77
|
+
const shouldPrompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
78
78
|
let inquirer;
|
|
79
79
|
let prompted = false;
|
|
80
80
|
for (let i = 0; i < command.options.length; i++) {
|
|
@@ -109,7 +109,7 @@ class Command {
|
|
|
109
109
|
return true;
|
|
110
110
|
}
|
|
111
111
|
let inquirer;
|
|
112
|
-
const shouldPrompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt,
|
|
112
|
+
const shouldPrompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
113
113
|
const argsOptions = Object.keys(args.options);
|
|
114
114
|
for (const optionSet of optionsSets.sort(opt => opt.runsWhen ? 0 : 1)) {
|
|
115
115
|
if (optionSet.runsWhen && !optionSet.runsWhen(args)) {
|
package/dist/cli/Cli.js
CHANGED
|
@@ -814,16 +814,16 @@ export class Cli {
|
|
|
814
814
|
}
|
|
815
815
|
return response;
|
|
816
816
|
}
|
|
817
|
-
static async handleMultipleResultsFound(
|
|
818
|
-
const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt,
|
|
817
|
+
static async handleMultipleResultsFound(message, values) {
|
|
818
|
+
const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
819
819
|
if (!prompt) {
|
|
820
|
-
throw
|
|
820
|
+
throw new Error(`${message} Found: ${Object.keys(values).join(', ')}.`);
|
|
821
821
|
}
|
|
822
822
|
const response = await Cli.prompt({
|
|
823
823
|
type: 'list',
|
|
824
824
|
name: 'select',
|
|
825
825
|
default: 0,
|
|
826
|
-
message:
|
|
826
|
+
message: `${message} Please choose one:`,
|
|
827
827
|
choices: Object.keys(values)
|
|
828
828
|
});
|
|
829
829
|
return values[response.select];
|
|
@@ -10,6 +10,7 @@ import { formatting } from '../../../../utils/formatting.js';
|
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
13
14
|
class AadAppGetCommand extends GraphCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.APP_GET;
|
|
@@ -59,7 +60,9 @@ class AadAppGetCommand extends GraphCommand {
|
|
|
59
60
|
const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
|
|
60
61
|
throw `No Azure AD application registration with ${applicationIdentifier} found`;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
64
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${name}' found.`, resultAsKeyValuePair);
|
|
65
|
+
return result.id;
|
|
63
66
|
}
|
|
64
67
|
async getAppInfo(appObjectId) {
|
|
65
68
|
const requestOptions = {
|
|
@@ -86,7 +86,9 @@ class AadAppRemoveCommand extends GraphCommand {
|
|
|
86
86
|
const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
|
|
87
87
|
throw `No Azure AD application registration with ${applicationIdentifier} found`;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
90
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${name}' found.`, resultAsKeyValuePair);
|
|
91
|
+
return result.id;
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
_AadAppRemoveCommand_instances = new WeakSet(), _AadAppRemoveCommand_initTelemetry = function _AadAppRemoveCommand_initTelemetry() {
|
|
@@ -9,6 +9,7 @@ import request from '../../../../request.js';
|
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
10
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
12
13
|
class AadAppRoleAddCommand extends GraphCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.APP_ROLE_ADD;
|
|
@@ -104,7 +105,9 @@ class AadAppRoleAddCommand extends GraphCommand {
|
|
|
104
105
|
const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
|
|
105
106
|
throw `No Azure AD application registration with ${applicationIdentifier} found`;
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
109
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${appName}' found.`, resultAsKeyValuePair);
|
|
110
|
+
return result.id;
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
_a = AadAppRoleAddCommand, _AadAppRoleAddCommand_instances = new WeakSet(), _AadAppRoleAddCommand_initTelemetry = function _AadAppRoleAddCommand_initTelemetry() {
|
|
@@ -9,6 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
|
|
|
9
9
|
import { odata } from '../../../../utils/odata.js';
|
|
10
10
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
12
13
|
class AadAppRoleListCommand extends GraphCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.APP_ROLE_LIST;
|
|
@@ -62,7 +63,9 @@ class AadAppRoleListCommand extends GraphCommand {
|
|
|
62
63
|
const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
|
|
63
64
|
throw `No Azure AD application registration with ${applicationIdentifier} found`;
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
67
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${appName}' found.`, resultAsKeyValuePair);
|
|
68
|
+
return result.id;
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
_AadAppRoleListCommand_instances = new WeakSet(), _AadAppRoleListCommand_initTelemetry = function _AadAppRoleListCommand_initTelemetry() {
|
|
@@ -63,7 +63,8 @@ class AadAppRoleRemoveCommand extends GraphCommand {
|
|
|
63
63
|
if (args.options.name &&
|
|
64
64
|
appRoleToDelete !== undefined &&
|
|
65
65
|
appRoleToDelete.length > 1) {
|
|
66
|
-
|
|
66
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', appRoleToDelete);
|
|
67
|
+
appRoleToDelete[0] = await Cli.handleMultipleResultsFound(`Multiple roles with name '${args.options.name}' found.`, resultAsKeyValuePair);
|
|
67
68
|
}
|
|
68
69
|
if (appRoleToDelete.length === 0) {
|
|
69
70
|
throw `No app role with ${appRoleDeleteIdentifierNameValue} found.`;
|
|
@@ -151,7 +152,9 @@ class AadAppRoleRemoveCommand extends GraphCommand {
|
|
|
151
152
|
const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
|
|
152
153
|
throw `No Azure AD application registration with ${applicationIdentifier} found`;
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
156
|
+
const result = (await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${appName}' found.`, resultAsKeyValuePair));
|
|
157
|
+
return result.id;
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
_AadAppRoleRemoveCommand_instances = new WeakSet(), _AadAppRoleRemoveCommand_initTelemetry = function _AadAppRoleRemoveCommand_initTelemetry() {
|
|
@@ -9,6 +9,7 @@ import request from '../../../../request.js';
|
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
10
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
12
13
|
class AadAppSetCommand extends GraphCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.APP_SET;
|
|
@@ -61,16 +62,18 @@ class AadAppSetCommand extends GraphCommand {
|
|
|
61
62
|
const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
|
|
62
63
|
throw `No Azure AD application registration with ${applicationIdentifier} found`;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
66
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${name}' found.`, resultAsKeyValuePair);
|
|
67
|
+
return result.id;
|
|
65
68
|
}
|
|
66
69
|
async configureUri(args, objectId, logger) {
|
|
67
|
-
if (!args.options.
|
|
70
|
+
if (!args.options.uris) {
|
|
68
71
|
return objectId;
|
|
69
72
|
}
|
|
70
73
|
if (this.verbose) {
|
|
71
74
|
await logger.logToStderr(`Configuring Azure AD application ID URI...`);
|
|
72
75
|
}
|
|
73
|
-
const identifierUris = args.options.
|
|
76
|
+
const identifierUris = args.options.uris
|
|
74
77
|
.split(',')
|
|
75
78
|
.map(u => u.trim());
|
|
76
79
|
const applicationInfo = {
|
|
@@ -238,14 +241,14 @@ _a = AadAppSetCommand, _AadAppSetCommand_instances = new WeakSet(), _AadAppSetCo
|
|
|
238
241
|
platform: typeof args.options.platform !== 'undefined',
|
|
239
242
|
redirectUris: typeof args.options.redirectUris !== 'undefined',
|
|
240
243
|
redirectUrisToRemove: typeof args.options.redirectUrisToRemove !== 'undefined',
|
|
241
|
-
|
|
244
|
+
uris: typeof args.options.uris !== 'undefined',
|
|
242
245
|
certificateFile: typeof args.options.certificateFile !== 'undefined',
|
|
243
246
|
certificateBase64Encoded: typeof args.options.certificateBase64Encoded !== 'undefined',
|
|
244
247
|
certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined'
|
|
245
248
|
});
|
|
246
249
|
});
|
|
247
250
|
}, _AadAppSetCommand_initOptions = function _AadAppSetCommand_initOptions() {
|
|
248
|
-
this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '-n, --name [name]' }, { option: '-u, --
|
|
251
|
+
this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '-n, --name [name]' }, { option: '-u, --uris [uris]' }, { option: '-r, --redirectUris [redirectUris]' }, { option: '--certificateFile [certificateFile]' }, { option: '--certificateBase64Encoded [certificateBase64Encoded]' }, { option: '--certificateDisplayName [certificateDisplayName]' }, {
|
|
249
252
|
option: '--platform [platform]',
|
|
250
253
|
autocomplete: _a.aadApplicationPlatform
|
|
251
254
|
}, { option: '--redirectUrisToRemove [redirectUrisToRemove]' });
|
|
@@ -10,6 +10,7 @@ import { formatting } from '../../../../utils/formatting.js';
|
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
13
14
|
class AadAppRoleAssignmentAddCommand extends GraphCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.APPROLEASSIGNMENT_ADD;
|
|
@@ -50,9 +51,13 @@ class AadAppRoleAssignmentAddCommand extends GraphCommand {
|
|
|
50
51
|
throw `The specified service principal doesn't exist`;
|
|
51
52
|
}
|
|
52
53
|
if (servicePrincipalResult.value.length > 1) {
|
|
53
|
-
|
|
54
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', servicePrincipalResult.value);
|
|
55
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple service principal found.`, resultAsKeyValuePair);
|
|
56
|
+
objectId = result.id;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
objectId = servicePrincipalResult.value[0].id;
|
|
54
60
|
}
|
|
55
|
-
objectId = servicePrincipalResult.value[0].id;
|
|
56
61
|
let resource = formatting.encodeQueryParameter(args.options.resource);
|
|
57
62
|
// try resolve aliases that the user might enter since these are seen in the Azure portal
|
|
58
63
|
switch (args.options.resource.toLocaleLowerCase()) {
|
|
@@ -94,13 +99,13 @@ class AadAppRoleAssignmentAddCommand extends GraphCommand {
|
|
|
94
99
|
if (!appRolesFound.length) {
|
|
95
100
|
throw `The resource '${args.options.resource}' does not have any application permissions available.`;
|
|
96
101
|
}
|
|
97
|
-
// search for match between the found app roles and the specified
|
|
98
|
-
for (const scope of args.options.
|
|
102
|
+
// search for match between the found app roles and the specified scopes option value
|
|
103
|
+
for (const scope of args.options.scopes.split(',')) {
|
|
99
104
|
const existingRoles = appRolesFound.filter((role) => {
|
|
100
105
|
return role.value.toLocaleLowerCase() === scope.toLocaleLowerCase().trim();
|
|
101
106
|
});
|
|
102
107
|
if (!existingRoles.length) {
|
|
103
|
-
// the role specified in the
|
|
108
|
+
// the role specified in the scopes option does not belong to the found service principles
|
|
104
109
|
// throw an error and show list with available roles (scopes)
|
|
105
110
|
let availableRoles = '';
|
|
106
111
|
appRolesFound.map((r) => availableRoles += `${os.EOL}${r.value}`);
|
|
@@ -163,7 +168,7 @@ _AadAppRoleAssignmentAddCommand_instances = new WeakSet(), _AadAppRoleAssignment
|
|
|
163
168
|
option: '-r, --resource <resource>',
|
|
164
169
|
autocomplete: ['Microsoft Graph', 'SharePoint', 'OneNote', 'Exchange', 'Microsoft Forms', 'Azure Active Directory Graph', 'Skype for Business']
|
|
165
170
|
}, {
|
|
166
|
-
option: '-s, --
|
|
171
|
+
option: '-s, --scopes <scopes>'
|
|
167
172
|
});
|
|
168
173
|
}, _AadAppRoleAssignmentAddCommand_initValidators = function _AadAppRoleAssignmentAddCommand_initValidators() {
|
|
169
174
|
this.validators.push(async (args) => {
|
|
@@ -80,12 +80,12 @@ class AadAppRoleAssignmentRemoveCommand extends GraphCommand {
|
|
|
80
80
|
if (!appRolesFound.length) {
|
|
81
81
|
throw `The resource '${args.options.resource}' does not have any application permissions available.`;
|
|
82
82
|
}
|
|
83
|
-
for (const scope of args.options.
|
|
83
|
+
for (const scope of args.options.scopes.split(',')) {
|
|
84
84
|
const existingRoles = appRolesFound.filter((role) => {
|
|
85
85
|
return role.value.toLocaleLowerCase() === scope.toLocaleLowerCase().trim();
|
|
86
86
|
});
|
|
87
87
|
if (!existingRoles.length) {
|
|
88
|
-
// the role specified in the
|
|
88
|
+
// the role specified in the scopes option does not belong to the found service principles
|
|
89
89
|
// throw an error and show list with available roles (scopes)
|
|
90
90
|
let availableRoles = '';
|
|
91
91
|
appRolesFound.map((r) => availableRoles += `${os.EOL}${r.value}`);
|
|
@@ -115,7 +115,7 @@ class AadAppRoleAssignmentRemoveCommand extends GraphCommand {
|
|
|
115
115
|
type: 'confirm',
|
|
116
116
|
name: 'continue',
|
|
117
117
|
default: false,
|
|
118
|
-
message: `Are you sure you want to remove the appRoleAssignment with
|
|
118
|
+
message: `Are you sure you want to remove the appRoleAssignment with scopes ${args.options.scopes} for resource ${args.options.resource}?`
|
|
119
119
|
});
|
|
120
120
|
if (result.continue) {
|
|
121
121
|
await removeAppRoleAssignment();
|
|
@@ -163,7 +163,7 @@ _AadAppRoleAssignmentRemoveCommand_instances = new WeakSet(), _AadAppRoleAssignm
|
|
|
163
163
|
option: '-r, --resource <resource>',
|
|
164
164
|
autocomplete: ['Microsoft Graph', 'SharePoint', 'OneNote', 'Exchange', 'Microsoft Forms', 'Azure Active Directory Graph', 'Skype for Business']
|
|
165
165
|
}, {
|
|
166
|
-
option: '-s, --
|
|
166
|
+
option: '-s, --scopes <scopes>'
|
|
167
167
|
}, {
|
|
168
168
|
option: '-f, --force'
|
|
169
169
|
});
|
|
@@ -30,7 +30,7 @@ class AadGroupGetCommand extends GraphCommand {
|
|
|
30
30
|
group = await aadGroup.getGroupById(args.options.id);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
group = await aadGroup.getGroupByDisplayName(args.options.
|
|
33
|
+
group = await aadGroup.getGroupByDisplayName(args.options.displayName);
|
|
34
34
|
}
|
|
35
35
|
await logger.log(group);
|
|
36
36
|
}
|
|
@@ -43,7 +43,7 @@ _AadGroupGetCommand_instances = new WeakSet(), _AadGroupGetCommand_initOptions =
|
|
|
43
43
|
this.options.unshift({
|
|
44
44
|
option: '-i, --id [id]'
|
|
45
45
|
}, {
|
|
46
|
-
option: '-
|
|
46
|
+
option: '-n, --displayName [displayName]'
|
|
47
47
|
});
|
|
48
48
|
}, _AadGroupGetCommand_initValidators = function _AadGroupGetCommand_initValidators() {
|
|
49
49
|
this.validators.push(async (args) => {
|
|
@@ -53,12 +53,12 @@ _AadGroupGetCommand_instances = new WeakSet(), _AadGroupGetCommand_initOptions =
|
|
|
53
53
|
return true;
|
|
54
54
|
});
|
|
55
55
|
}, _AadGroupGetCommand_initOptionSets = function _AadGroupGetCommand_initOptionSets() {
|
|
56
|
-
this.optionSets.push({ options: ['id', '
|
|
56
|
+
this.optionSets.push({ options: ['id', 'displayName'] });
|
|
57
57
|
}, _AadGroupGetCommand_initTelemetry = function _AadGroupGetCommand_initTelemetry() {
|
|
58
58
|
this.telemetry.push((args) => {
|
|
59
59
|
Object.assign(this.telemetryProperties, {
|
|
60
60
|
id: typeof args.options.id !== 'undefined',
|
|
61
|
-
|
|
61
|
+
displayName: typeof args.options.displayName !== 'undefined'
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _AadGroupListCommand_instances, _AadGroupListCommand_initTelemetry, _AadGroupListCommand_initOptions;
|
|
7
1
|
import { Cli } from '../../../../cli/Cli.js';
|
|
8
2
|
import { odata } from '../../../../utils/odata.js';
|
|
9
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
@@ -15,19 +9,12 @@ class AadGroupListCommand extends GraphCommand {
|
|
|
15
9
|
get description() {
|
|
16
10
|
return 'Lists all groups defined in Azure Active Directory.';
|
|
17
11
|
}
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
_AadGroupListCommand_instances.add(this);
|
|
21
|
-
__classPrivateFieldGet(this, _AadGroupListCommand_instances, "m", _AadGroupListCommand_initTelemetry).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _AadGroupListCommand_instances, "m", _AadGroupListCommand_initOptions).call(this);
|
|
23
|
-
}
|
|
24
12
|
defaultProperties() {
|
|
25
13
|
return ['id', 'displayName', 'groupType'];
|
|
26
14
|
}
|
|
27
15
|
async commandAction(logger, args) {
|
|
28
|
-
const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.group' : 'groups';
|
|
29
16
|
try {
|
|
30
|
-
const groups = await odata.getAllItems(`${this.resource}/v1.0
|
|
17
|
+
const groups = await odata.getAllItems(`${this.resource}/v1.0/groups`);
|
|
31
18
|
if (Cli.shouldTrimOutput(args.options.output)) {
|
|
32
19
|
groups.forEach((group) => {
|
|
33
20
|
if (group.groupTypes && group.groupTypes.length > 0 && group.groupTypes[0] === 'Unified') {
|
|
@@ -51,14 +38,5 @@ class AadGroupListCommand extends GraphCommand {
|
|
|
51
38
|
}
|
|
52
39
|
}
|
|
53
40
|
}
|
|
54
|
-
_AadGroupListCommand_instances = new WeakSet(), _AadGroupListCommand_initTelemetry = function _AadGroupListCommand_initTelemetry() {
|
|
55
|
-
this.telemetry.push((args) => {
|
|
56
|
-
Object.assign(this.telemetryProperties, {
|
|
57
|
-
deleted: args.options.deleted
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}, _AadGroupListCommand_initOptions = function _AadGroupListCommand_initOptions() {
|
|
61
|
-
this.options.unshift({ option: '-d, --deleted' });
|
|
62
|
-
};
|
|
63
41
|
export default new AadGroupListCommand();
|
|
64
42
|
//# sourceMappingURL=group-list.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _AadGroupRemoveCommand_instances, _AadGroupRemoveCommand_initTelemetry, _AadGroupRemoveCommand_initOptions, _AadGroupRemoveCommand_initOptionSets, _AadGroupRemoveCommand_initValidators, _AadGroupRemoveCommand_initTypes;
|
|
7
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
8
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
|
+
import commands from '../../commands.js';
|
|
10
|
+
import request from '../../../../request.js';
|
|
11
|
+
import { aadGroup } from '../../../../utils/aadGroup.js';
|
|
12
|
+
import { validation } from '../../../../utils/validation.js';
|
|
13
|
+
class AadGroupRemoveCommand extends GraphCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.GROUP_REMOVE;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Removes an Azure AD group';
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_AadGroupRemoveCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _AadGroupRemoveCommand_instances, "m", _AadGroupRemoveCommand_initOptions).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _AadGroupRemoveCommand_instances, "m", _AadGroupRemoveCommand_initValidators).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _AadGroupRemoveCommand_instances, "m", _AadGroupRemoveCommand_initOptionSets).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _AadGroupRemoveCommand_instances, "m", _AadGroupRemoveCommand_initTelemetry).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _AadGroupRemoveCommand_instances, "m", _AadGroupRemoveCommand_initTypes).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
const removeGroup = async () => {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.logToStderr(`Removing group ${args.options.id || args.options.displayName}...`);
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
let groupId = args.options.id;
|
|
36
|
+
if (args.options.displayName) {
|
|
37
|
+
groupId = await aadGroup.getGroupIdByDisplayName(args.options.displayName);
|
|
38
|
+
}
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${this.resource}/v1.0/groups/${groupId}`,
|
|
41
|
+
headers: {
|
|
42
|
+
accept: 'application/json;odata.metadata=none'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
await request.delete(requestOptions);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
this.handleRejectedODataJsonPromise(err);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (args.options.force) {
|
|
52
|
+
await removeGroup();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const result = await Cli.prompt({
|
|
56
|
+
type: 'confirm',
|
|
57
|
+
name: 'continue',
|
|
58
|
+
default: false,
|
|
59
|
+
message: `Are you sure you want to remove group '${args.options.id || args.options.displayName}'?`
|
|
60
|
+
});
|
|
61
|
+
if (result.continue) {
|
|
62
|
+
await removeGroup();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
_AadGroupRemoveCommand_instances = new WeakSet(), _AadGroupRemoveCommand_initTelemetry = function _AadGroupRemoveCommand_initTelemetry() {
|
|
68
|
+
this.telemetry.push((args) => {
|
|
69
|
+
Object.assign(this.telemetryProperties, {
|
|
70
|
+
id: args.options.id !== 'undefined',
|
|
71
|
+
displayName: args.options.displayName !== 'undefined',
|
|
72
|
+
force: !!args.options.force
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}, _AadGroupRemoveCommand_initOptions = function _AadGroupRemoveCommand_initOptions() {
|
|
76
|
+
this.options.unshift({
|
|
77
|
+
option: '-i, --id [id]'
|
|
78
|
+
}, {
|
|
79
|
+
option: '-n, --displayName [displayName]'
|
|
80
|
+
}, {
|
|
81
|
+
option: '-f, --force'
|
|
82
|
+
});
|
|
83
|
+
}, _AadGroupRemoveCommand_initOptionSets = function _AadGroupRemoveCommand_initOptionSets() {
|
|
84
|
+
this.optionSets.push({
|
|
85
|
+
options: ['id', 'displayName']
|
|
86
|
+
});
|
|
87
|
+
}, _AadGroupRemoveCommand_initValidators = function _AadGroupRemoveCommand_initValidators() {
|
|
88
|
+
this.validators.push(async (args) => {
|
|
89
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
90
|
+
return `${args.options.id} is not a valid GUID for option id.`;
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
}, _AadGroupRemoveCommand_initTypes = function _AadGroupRemoveCommand_initTypes() {
|
|
95
|
+
this.types.string.push('id', 'displayName');
|
|
96
|
+
};
|
|
97
|
+
export default new AadGroupRemoveCommand();
|
|
98
|
+
//# sourceMappingURL=group-remove.js.map
|
|
@@ -22,6 +22,7 @@ class AadM365GroupAddCommand extends GraphCommand {
|
|
|
22
22
|
super();
|
|
23
23
|
_AadM365GroupAddCommand_instances.add(this);
|
|
24
24
|
this.pollingInterval = 500;
|
|
25
|
+
this.allowedVisibilities = ['Private', 'Public', 'HiddenMembership'];
|
|
25
26
|
__classPrivateFieldGet(this, _AadM365GroupAddCommand_instances, "m", _AadM365GroupAddCommand_initTelemetry).call(this);
|
|
26
27
|
__classPrivateFieldGet(this, _AadM365GroupAddCommand_instances, "m", _AadM365GroupAddCommand_initOptions).call(this);
|
|
27
28
|
__classPrivateFieldGet(this, _AadM365GroupAddCommand_instances, "m", _AadM365GroupAddCommand_initTypes).call(this);
|
|
@@ -32,20 +33,21 @@ class AadM365GroupAddCommand extends GraphCommand {
|
|
|
32
33
|
let ownerIds = [];
|
|
33
34
|
let memberIds = [];
|
|
34
35
|
const resourceBehaviorOptionsCollection = [];
|
|
36
|
+
const resolvedVisibility = args.options.visibility || 'Public';
|
|
35
37
|
if (this.verbose) {
|
|
36
|
-
await logger.logToStderr(
|
|
38
|
+
await logger.logToStderr('Creating Microsoft 365 Group...');
|
|
37
39
|
}
|
|
38
40
|
if (args.options.allowMembersToPost) {
|
|
39
|
-
resourceBehaviorOptionsCollection.push(
|
|
41
|
+
resourceBehaviorOptionsCollection.push('AllowOnlyMembersToPost');
|
|
40
42
|
}
|
|
41
43
|
if (args.options.hideGroupInOutlook) {
|
|
42
|
-
resourceBehaviorOptionsCollection.push(
|
|
44
|
+
resourceBehaviorOptionsCollection.push('HideGroupInOutlook');
|
|
43
45
|
}
|
|
44
46
|
if (args.options.subscribeNewGroupMembers) {
|
|
45
|
-
resourceBehaviorOptionsCollection.push(
|
|
47
|
+
resourceBehaviorOptionsCollection.push('SubscribeNewGroupMembers');
|
|
46
48
|
}
|
|
47
49
|
if (args.options.welcomeEmailDisabled) {
|
|
48
|
-
resourceBehaviorOptionsCollection.push(
|
|
50
|
+
resourceBehaviorOptionsCollection.push('WelcomeEmailDisabled');
|
|
49
51
|
}
|
|
50
52
|
const requestOptions = {
|
|
51
53
|
url: `${this.resource}/v1.0/groups`,
|
|
@@ -63,7 +65,7 @@ class AadM365GroupAddCommand extends GraphCommand {
|
|
|
63
65
|
mailNickname: args.options.mailNickname,
|
|
64
66
|
resourceBehaviorOptions: resourceBehaviorOptionsCollection,
|
|
65
67
|
securityEnabled: false,
|
|
66
|
-
visibility:
|
|
68
|
+
visibility: resolvedVisibility
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
71
|
try {
|
|
@@ -185,11 +187,11 @@ _AadM365GroupAddCommand_instances = new WeakSet(), _AadM365GroupAddCommand_initT
|
|
|
185
187
|
owners: typeof args.options.owners !== 'undefined',
|
|
186
188
|
members: typeof args.options.members !== 'undefined',
|
|
187
189
|
logoPath: typeof args.options.logoPath !== 'undefined',
|
|
188
|
-
|
|
189
|
-
allowMembersToPost: args.options.allowMembersToPost,
|
|
190
|
-
hideGroupInOutlook: args.options.hideGroupInOutlook,
|
|
191
|
-
subscribeNewGroupMembers: args.options.subscribeNewGroupMembers,
|
|
192
|
-
welcomeEmailDisabled: args.options.welcomeEmailDisabled
|
|
190
|
+
visibility: typeof args.options.visibility !== 'undefined',
|
|
191
|
+
allowMembersToPost: !!args.options.allowMembersToPost,
|
|
192
|
+
hideGroupInOutlook: !!args.options.hideGroupInOutlook,
|
|
193
|
+
subscribeNewGroupMembers: !!args.options.subscribeNewGroupMembers,
|
|
194
|
+
welcomeEmailDisabled: !!args.options.welcomeEmailDisabled
|
|
193
195
|
});
|
|
194
196
|
});
|
|
195
197
|
}, _AadM365GroupAddCommand_initOptions = function _AadM365GroupAddCommand_initOptions() {
|
|
@@ -204,7 +206,8 @@ _AadM365GroupAddCommand_instances = new WeakSet(), _AadM365GroupAddCommand_initT
|
|
|
204
206
|
}, {
|
|
205
207
|
option: '--members [members]'
|
|
206
208
|
}, {
|
|
207
|
-
option: '--
|
|
209
|
+
option: '--visibility [visibility]',
|
|
210
|
+
autocomplete: this.allowedVisibilities
|
|
208
211
|
}, {
|
|
209
212
|
option: '--allowMembersToPost [allowMembersToPost]',
|
|
210
213
|
autocomplete: ['true', 'false']
|
|
@@ -240,6 +243,9 @@ _AadM365GroupAddCommand_instances = new WeakSet(), _AadM365GroupAddCommand_initT
|
|
|
240
243
|
}
|
|
241
244
|
}
|
|
242
245
|
}
|
|
246
|
+
if (args.options.mailNickname.indexOf(' ') !== -1) {
|
|
247
|
+
return 'The option mailNickname cannot contain spaces.';
|
|
248
|
+
}
|
|
243
249
|
if (args.options.logoPath) {
|
|
244
250
|
const fullPath = path.resolve(args.options.logoPath);
|
|
245
251
|
if (!fs.existsSync(fullPath)) {
|
|
@@ -249,6 +255,9 @@ _AadM365GroupAddCommand_instances = new WeakSet(), _AadM365GroupAddCommand_initT
|
|
|
249
255
|
return `Path '${fullPath}' points to a directory`;
|
|
250
256
|
}
|
|
251
257
|
}
|
|
258
|
+
if (args.options.visibility && this.allowedVisibilities.map(x => x.toLowerCase()).indexOf(args.options.visibility.toLowerCase()) === -1) {
|
|
259
|
+
return `${args.options.visibility} is not a valid visibility. Allowed values are ${this.allowedVisibilities.join(', ')}`;
|
|
260
|
+
}
|
|
252
261
|
return true;
|
|
253
262
|
});
|
|
254
263
|
};
|
|
@@ -8,6 +8,7 @@ import { odata } from '../../../../utils/odata.js';
|
|
|
8
8
|
import { validation } from '../../../../utils/validation.js';
|
|
9
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
10
|
import commands from '../../commands.js';
|
|
11
|
+
import { aadGroup } from '../../../../utils/aadGroup.js';
|
|
11
12
|
class AadM365GroupConversationListCommand extends GraphCommand {
|
|
12
13
|
get name() {
|
|
13
14
|
return commands.M365GROUP_CONVERSATION_LIST;
|
|
@@ -26,6 +27,10 @@ class AadM365GroupConversationListCommand extends GraphCommand {
|
|
|
26
27
|
}
|
|
27
28
|
async commandAction(logger, args) {
|
|
28
29
|
try {
|
|
30
|
+
const isUnifiedGroup = await aadGroup.isUnifiedGroup(args.options.groupId);
|
|
31
|
+
if (!isUnifiedGroup) {
|
|
32
|
+
throw Error(`Specified group with id '${args.options.groupId}' is not a Microsoft 365 group.`);
|
|
33
|
+
}
|
|
29
34
|
const conversations = await odata.getAllItems(`${this.resource}/v1.0/groups/${args.options.groupId}/conversations`);
|
|
30
35
|
await logger.log(conversations);
|
|
31
36
|
}
|
|
@@ -31,6 +31,10 @@ class AadM365GroupConversationPostListCommand extends GraphCommand {
|
|
|
31
31
|
async commandAction(logger, args) {
|
|
32
32
|
try {
|
|
33
33
|
const retrievedgroupId = await this.getGroupId(args);
|
|
34
|
+
const isUnifiedGroup = await aadGroup.isUnifiedGroup(retrievedgroupId);
|
|
35
|
+
if (!isUnifiedGroup) {
|
|
36
|
+
throw Error(`Specified group with id '${retrievedgroupId}' is not a Microsoft 365 group.`);
|
|
37
|
+
}
|
|
34
38
|
const posts = await odata.getAllItems(`${this.resource}/v1.0/groups/${retrievedgroupId}/threads/${args.options.threadId}/posts`);
|
|
35
39
|
await logger.log(posts);
|
|
36
40
|
}
|
|
@@ -25,10 +25,11 @@ class AadM365GroupGetCommand extends GraphCommand {
|
|
|
25
25
|
async commandAction(logger, args) {
|
|
26
26
|
let group;
|
|
27
27
|
try {
|
|
28
|
-
|
|
29
|
-
if (!
|
|
30
|
-
throw `Specified group with id '${args.options.id}' is not a Microsoft 365 group
|
|
28
|
+
const isUnifiedGroup = await aadGroup.isUnifiedGroup(args.options.id);
|
|
29
|
+
if (!isUnifiedGroup) {
|
|
30
|
+
throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
|
|
31
31
|
}
|
|
32
|
+
group = await aadGroup.getGroupById(args.options.id);
|
|
32
33
|
if (args.options.includeSiteUrl) {
|
|
33
34
|
const requestOptions = {
|
|
34
35
|
url: `${this.resource}/v1.0/groups/${group.id}/drive?$select=webUrl`,
|
|
@@ -82,7 +82,9 @@ class AadM365GroupRecycleBinItemRemoveCommand extends GraphCommand {
|
|
|
82
82
|
throw Error(`The specified group '${displayName || mailNickname}' does not exist.`);
|
|
83
83
|
}
|
|
84
84
|
if (groups.length > 1) {
|
|
85
|
-
|
|
85
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', groups);
|
|
86
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple groups with name '${displayName || mailNickname}' found.`, resultAsKeyValuePair);
|
|
87
|
+
return result.id;
|
|
86
88
|
}
|
|
87
89
|
return groups[0].id;
|
|
88
90
|
}
|