@pnp/cli-microsoft365 7.5.0-beta.23612bc → 7.5.0-beta.940b241
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/.eslintrc.cjs +6 -2
- package/.mocharc.json +3 -5
- package/README.md +2 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +1 -1
- package/dist/m365/base/AppCommand.js +2 -2
- package/dist/m365/base/{YammerCommand.js → VivaEngageCommand.js} +2 -2
- package/dist/m365/cli/commands/cli-consent.js +5 -3
- package/dist/m365/entra/aadCommands.js +3 -0
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-remove.js +153 -0
- package/dist/m365/entra/commands/app/app-add.js +1 -1
- package/dist/m365/entra/commands/app/app-get.js +1 -1
- package/dist/m365/entra/commands/app/app-list.js +1 -1
- package/dist/m365/entra/commands/app/app-permission-add.js +1 -1
- package/dist/m365/entra/commands/app/app-permission-list.js +182 -0
- package/dist/m365/entra/commands/app/app-remove.js +1 -1
- package/dist/m365/entra/commands/app/app-role-add.js +1 -1
- package/dist/m365/entra/commands/app/app-role-list.js +1 -1
- package/dist/m365/entra/commands/app/app-role-remove.js +1 -1
- package/dist/m365/entra/commands/app/app-set.js +1 -1
- package/dist/m365/entra/commands/{sp/sp-add.js → enterpriseapp/enterpriseapp-add.js} +18 -18
- package/dist/m365/entra/commands/{sp/sp-get.js → enterpriseapp/enterpriseapp-get.js} +19 -19
- package/dist/m365/entra/commands/{sp/sp-list.js → enterpriseapp/enterpriseapp-list.js} +13 -13
- package/dist/m365/entra/commands/group/group-add.js +224 -0
- package/dist/m365/entra/commands/m365group/m365group-report-activitygroupcounts.js +1 -1
- package/dist/m365/entra/commands/user/user-get.js +38 -38
- package/dist/m365/entra/commands/user/user-registrationdetails-list.js +224 -0
- package/dist/m365/entra/commands.js +16 -0
- package/dist/m365/file/commands/file-copy.js +151 -0
- package/dist/m365/file/commands.js +1 -0
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +4 -3
- package/dist/m365/{yammer/commands/group/group-list.js → viva/commands/engage/engage-group-list.js} +19 -14
- package/dist/m365/{yammer/commands/group/group-user-add.js → viva/commands/engage/engage-group-user-add.js} +19 -14
- package/dist/m365/{yammer/commands/group/group-user-remove.js → viva/commands/engage/engage-group-user-remove.js} +19 -14
- package/dist/m365/{yammer/commands/message/message-add.js → viva/commands/engage/engage-message-add.js} +19 -14
- package/dist/m365/{yammer/commands/message/message-get.js → viva/commands/engage/engage-message-get.js} +17 -12
- package/dist/m365/{yammer/commands/message/message-like-set.js → viva/commands/engage/engage-message-like-set.js} +21 -16
- package/dist/m365/{yammer/commands/message/message-list.js → viva/commands/engage/engage-message-list.js} +21 -16
- package/dist/m365/{yammer/commands/message/message-remove.js → viva/commands/engage/engage-message-remove.js} +20 -15
- package/dist/m365/{yammer/commands/network/network-list.js → viva/commands/engage/engage-network-list.js} +16 -11
- package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +23 -0
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +23 -0
- package/dist/m365/{yammer/commands/yammer-search.js → viva/commands/engage/engage-search.js} +23 -18
- package/dist/m365/{yammer/commands/user/user-get.js → viva/commands/engage/engage-user-get.js} +18 -13
- package/dist/m365/{yammer/commands/user/user-list.js → viva/commands/engage/engage-user-list.js} +18 -13
- package/dist/m365/{yammer/commands.js → viva/commands/engage/yammerCommands.js} +1 -1
- package/dist/m365/viva/commands.js +22 -1
- package/dist/utils/spo.js +22 -0
- package/dist/utils/urlUtil.js +31 -0
- package/dist/utils/validation.js +4 -0
- package/docs/docs/cmd/cli/cli-consent.mdx +9 -9
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-member-add.mdx +5 -3
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-member-remove.mdx +107 -0
- package/docs/docs/cmd/entra/app/app-add.mdx +2 -1
- package/docs/docs/cmd/entra/app/app-get.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-list.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-permission-add.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-permission-list.mdx +105 -0
- package/docs/docs/cmd/entra/app/app-remove.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-role-add.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-role-list.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-role-remove.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-set.mdx +1 -0
- package/docs/docs/cmd/entra/{sp/sp-add.mdx → enterpriseapp/enterpriseapp-add.mdx} +16 -15
- package/docs/docs/cmd/entra/{sp/sp-get.mdx → enterpriseapp/enterpriseapp-get.mdx} +15 -14
- package/docs/docs/cmd/entra/{sp/sp-list.mdx → enterpriseapp/enterpriseapp-list.mdx} +22 -21
- package/docs/docs/cmd/entra/group/group-add.mdx +231 -0
- package/docs/docs/cmd/entra/m365group/m365group-report-activitygroupcounts.mdx +1 -1
- package/docs/docs/cmd/entra/oauth2grant/oauth2grant-add.mdx +3 -3
- package/docs/docs/cmd/entra/oauth2grant/oauth2grant-list.mdx +1 -1
- package/docs/docs/cmd/entra/user/user-registrationdetails-list.mdx +246 -0
- package/docs/docs/cmd/external/item/item-add.mdx +1 -1
- package/docs/docs/cmd/file/convert/convert-pdf.mdx +4 -0
- package/docs/docs/cmd/file/file-add.mdx +4 -0
- package/docs/docs/cmd/file/file-copy.mdx +68 -0
- package/docs/docs/cmd/file/file-list.mdx +100 -0
- package/docs/docs/cmd/setup.mdx +4 -0
- package/docs/docs/cmd/spo/list/list-webhook-set.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-set.mdx +14 -2
- package/docs/docs/cmd/{yammer/group/group-list.mdx → viva/engage/engage-group-list.mdx} +13 -13
- package/docs/docs/cmd/{yammer/group/group-user-add.mdx → viva/engage/engage-group-user-add.mdx} +7 -7
- package/docs/docs/cmd/{yammer/group/group-user-remove.mdx → viva/engage/engage-group-user-remove.mdx} +10 -10
- package/docs/docs/cmd/{yammer/message/message-add.mdx → viva/engage/engage-message-add.mdx} +12 -13
- package/docs/docs/cmd/{yammer/message/message-get.mdx → viva/engage/engage-message-get.mdx} +10 -10
- package/docs/docs/cmd/{yammer/message/message-like-set.mdx → viva/engage/engage-message-like-set.mdx} +10 -10
- package/docs/docs/cmd/{yammer/message/message-list.mdx → viva/engage/engage-message-list.mdx} +21 -21
- package/docs/docs/cmd/{yammer/message/message-remove.mdx → viva/engage/engage-message-remove.mdx} +10 -10
- package/docs/docs/cmd/{yammer/network/network-list.mdx → viva/engage/engage-network-list.mdx} +6 -6
- package/docs/docs/cmd/{yammer/report/report-activitycounts.mdx → viva/engage/engage-report-activitycounts.mdx} +9 -9
- package/docs/docs/cmd/{yammer/report/report-activityusercounts.mdx → viva/engage/engage-report-activityusercounts.mdx} +9 -9
- package/docs/docs/cmd/{yammer/report/report-activityuserdetail.mdx → viva/engage/engage-report-activityuserdetail.mdx} +11 -12
- package/docs/docs/cmd/{yammer/report/report-deviceusagedistributionusercounts.mdx → viva/engage/engage-report-deviceusagedistributionusercounts.mdx} +5 -5
- package/docs/docs/cmd/{yammer/report/report-deviceusageusercounts.mdx → viva/engage/engage-report-deviceusageusercounts.mdx} +5 -5
- package/docs/docs/cmd/{yammer/report/report-deviceusageuserdetail.mdx → viva/engage/engage-report-deviceusageuserdetail.mdx} +11 -11
- package/docs/docs/cmd/{yammer/report/report-groupsactivitycounts.mdx → viva/engage/engage-report-groupsactivitycounts.mdx} +9 -9
- package/docs/docs/cmd/{yammer/report/report-groupsactivitydetail.mdx → viva/engage/engage-report-groupsactivitydetail.mdx} +11 -11
- package/docs/docs/cmd/{yammer/report/report-groupsactivitygroupcounts.mdx → viva/engage/engage-report-groupsactivitygroupcounts.mdx} +5 -5
- package/docs/docs/cmd/{yammer/yammer-search.mdx → viva/engage/engage-search.mdx} +10 -10
- package/docs/docs/cmd/{yammer/user/user-get.mdx → viva/engage/engage-user-get.mdx} +8 -8
- package/docs/docs/cmd/{yammer/user/user-list.mdx → viva/engage/engage-user-list.mdx} +11 -11
- package/npm-shrinkwrap.json +60 -0
- package/package.json +3 -2
- package/dist/m365/base/AzmgmtCommand.js +0 -18
- package/dist/m365/base/AzmgmtItemsListCommand.js +0 -41
- package/dist/m365/yammer/commands/report/report-activitycounts.js +0 -15
- package/dist/m365/yammer/commands/report/report-activityusercounts.js +0 -15
- package/dist/m365/yammer/commands/report/report-activityuserdetail.js +0 -15
- package/dist/m365/yammer/commands/report/report-deviceusagedistributionusercounts.js +0 -15
- package/dist/m365/yammer/commands/report/report-deviceusageusercounts.js +0 -15
- package/dist/m365/yammer/commands/report/report-deviceusageuserdetail.js +0 -15
- package/dist/m365/yammer/commands/report/report-groupsactivitycounts.js +0 -15
- package/dist/m365/yammer/commands/report/report-groupsactivitydetail.js +0 -15
- package/dist/m365/yammer/commands/report/report-groupsactivitygroupcounts.js +0 -15
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
6
|
+
var _EntraEnterpriseAppGetCommand_instances, _EntraEnterpriseAppGetCommand_initTelemetry, _EntraEnterpriseAppGetCommand_initOptions, _EntraEnterpriseAppGetCommand_initValidators, _EntraEnterpriseAppGetCommand_initOptionSets;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -11,23 +11,23 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
11
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
12
|
import aadCommands from '../../aadCommands.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
|
-
class
|
|
14
|
+
class EntraEnterpriseAppGetCommand extends GraphCommand {
|
|
15
15
|
get name() {
|
|
16
|
-
return commands.
|
|
16
|
+
return commands.ENTERPRISEAPP_GET;
|
|
17
17
|
}
|
|
18
18
|
get description() {
|
|
19
|
-
return 'Gets information about
|
|
19
|
+
return 'Gets information about an Enterprise Application';
|
|
20
20
|
}
|
|
21
21
|
alias() {
|
|
22
|
-
return [aadCommands.SP_GET];
|
|
22
|
+
return [aadCommands.SP_GET, commands.SP_GET];
|
|
23
23
|
}
|
|
24
24
|
constructor() {
|
|
25
25
|
super();
|
|
26
|
-
|
|
27
|
-
__classPrivateFieldGet(this,
|
|
28
|
-
__classPrivateFieldGet(this,
|
|
29
|
-
__classPrivateFieldGet(this,
|
|
30
|
-
__classPrivateFieldGet(this,
|
|
26
|
+
_EntraEnterpriseAppGetCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppGetCommand_instances, "m", _EntraEnterpriseAppGetCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppGetCommand_instances, "m", _EntraEnterpriseAppGetCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppGetCommand_instances, "m", _EntraEnterpriseAppGetCommand_initValidators).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppGetCommand_instances, "m", _EntraEnterpriseAppGetCommand_initOptionSets).call(this);
|
|
31
31
|
}
|
|
32
32
|
async getSpId(args) {
|
|
33
33
|
if (args.options.appObjectId) {
|
|
@@ -50,18 +50,18 @@ class EntraSpGetCommand extends GraphCommand {
|
|
|
50
50
|
const response = await request.get(idRequestOptions);
|
|
51
51
|
const spItem = response.value[0];
|
|
52
52
|
if (!spItem) {
|
|
53
|
-
throw `The specified
|
|
53
|
+
throw `The specified Entra app does not exist`;
|
|
54
54
|
}
|
|
55
55
|
if (response.value.length > 1) {
|
|
56
56
|
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
57
|
-
const result = await cli.handleMultipleResultsFound(`Multiple
|
|
57
|
+
const result = await cli.handleMultipleResultsFound(`Multiple Entra apps with name '${args.options.appDisplayName}' found.`, resultAsKeyValuePair);
|
|
58
58
|
return result.id;
|
|
59
59
|
}
|
|
60
60
|
return spItem.id;
|
|
61
61
|
}
|
|
62
62
|
async commandAction(logger, args) {
|
|
63
63
|
if (this.verbose) {
|
|
64
|
-
await logger.logToStderr(`Retrieving
|
|
64
|
+
await logger.logToStderr(`Retrieving enterprise application information...`);
|
|
65
65
|
}
|
|
66
66
|
try {
|
|
67
67
|
const id = await this.getSpId(args);
|
|
@@ -81,7 +81,7 @@ class EntraSpGetCommand extends GraphCommand {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
_EntraEnterpriseAppGetCommand_instances = new WeakSet(), _EntraEnterpriseAppGetCommand_initTelemetry = function _EntraEnterpriseAppGetCommand_initTelemetry() {
|
|
85
85
|
this.telemetry.push((args) => {
|
|
86
86
|
Object.assign(this.telemetryProperties, {
|
|
87
87
|
appId: (!(!args.options.appId)).toString(),
|
|
@@ -89,7 +89,7 @@ _EntraSpGetCommand_instances = new WeakSet(), _EntraSpGetCommand_initTelemetry =
|
|
|
89
89
|
appObjectId: (!(!args.options.appObjectId)).toString()
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
-
},
|
|
92
|
+
}, _EntraEnterpriseAppGetCommand_initOptions = function _EntraEnterpriseAppGetCommand_initOptions() {
|
|
93
93
|
this.options.unshift({
|
|
94
94
|
option: '-i, --appId [appId]'
|
|
95
95
|
}, {
|
|
@@ -97,7 +97,7 @@ _EntraSpGetCommand_instances = new WeakSet(), _EntraSpGetCommand_initTelemetry =
|
|
|
97
97
|
}, {
|
|
98
98
|
option: '--appObjectId [appObjectId]'
|
|
99
99
|
});
|
|
100
|
-
},
|
|
100
|
+
}, _EntraEnterpriseAppGetCommand_initValidators = function _EntraEnterpriseAppGetCommand_initValidators() {
|
|
101
101
|
this.validators.push(async (args) => {
|
|
102
102
|
if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
|
|
103
103
|
return `${args.options.appId} is not a valid appId GUID`;
|
|
@@ -107,8 +107,8 @@ _EntraSpGetCommand_instances = new WeakSet(), _EntraSpGetCommand_initTelemetry =
|
|
|
107
107
|
}
|
|
108
108
|
return true;
|
|
109
109
|
});
|
|
110
|
-
},
|
|
110
|
+
}, _EntraEnterpriseAppGetCommand_initOptionSets = function _EntraEnterpriseAppGetCommand_initOptionSets() {
|
|
111
111
|
this.optionSets.push({ options: ['appId', 'appDisplayName', 'appObjectId'] });
|
|
112
112
|
};
|
|
113
|
-
export default new
|
|
114
|
-
//# sourceMappingURL=
|
|
113
|
+
export default new EntraEnterpriseAppGetCommand();
|
|
114
|
+
//# sourceMappingURL=enterpriseapp-get.js.map
|
|
@@ -3,33 +3,33 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
6
|
+
var _EntraEnterpriseAppListCommand_instances, _EntraEnterpriseAppListCommand_initTelemetry, _EntraEnterpriseAppListCommand_initOptions;
|
|
7
7
|
import { odata } from '../../../../utils/odata.js';
|
|
8
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
9
|
import aadCommands from '../../aadCommands.js';
|
|
10
10
|
import commands from '../../commands.js';
|
|
11
|
-
class
|
|
11
|
+
class EntraEnterpriseAppListCommand extends GraphCommand {
|
|
12
12
|
get name() {
|
|
13
|
-
return commands.
|
|
13
|
+
return commands.ENTERPRISEAPP_LIST;
|
|
14
14
|
}
|
|
15
15
|
defaultProperties() {
|
|
16
16
|
return ['appId', 'displayName', 'tag'];
|
|
17
17
|
}
|
|
18
18
|
get description() {
|
|
19
|
-
return 'Lists the service principals in
|
|
19
|
+
return 'Lists the enterprise applications (or service principals) in Entra ID';
|
|
20
20
|
}
|
|
21
21
|
alias() {
|
|
22
|
-
return [aadCommands.SP_LIST];
|
|
22
|
+
return [aadCommands.SP_LIST, commands.SP_LIST];
|
|
23
23
|
}
|
|
24
24
|
constructor() {
|
|
25
25
|
super();
|
|
26
|
-
|
|
27
|
-
__classPrivateFieldGet(this,
|
|
28
|
-
__classPrivateFieldGet(this,
|
|
26
|
+
_EntraEnterpriseAppListCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppListCommand_instances, "m", _EntraEnterpriseAppListCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppListCommand_instances, "m", _EntraEnterpriseAppListCommand_initOptions).call(this);
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
31
|
if (this.verbose) {
|
|
32
|
-
await logger.logToStderr(`Retrieving
|
|
32
|
+
await logger.logToStderr(`Retrieving enterprise application information...`);
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
35
|
let requestUrl = `${this.resource}/v1.0/servicePrincipals`;
|
|
@@ -51,19 +51,19 @@ class EntraSpListCommand extends GraphCommand {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
_EntraEnterpriseAppListCommand_instances = new WeakSet(), _EntraEnterpriseAppListCommand_initTelemetry = function _EntraEnterpriseAppListCommand_initTelemetry() {
|
|
55
55
|
this.telemetry.push((args) => {
|
|
56
56
|
Object.assign(this.telemetryProperties, {
|
|
57
57
|
displayName: typeof args.options.displayName !== 'undefined',
|
|
58
58
|
tag: typeof args.options.tag !== 'undefined'
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
},
|
|
61
|
+
}, _EntraEnterpriseAppListCommand_initOptions = function _EntraEnterpriseAppListCommand_initOptions() {
|
|
62
62
|
this.options.unshift({
|
|
63
63
|
option: '--displayName [displayName]'
|
|
64
64
|
}, {
|
|
65
65
|
option: '--tag [tag]'
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
export default new
|
|
69
|
-
//# sourceMappingURL=
|
|
68
|
+
export default new EntraEnterpriseAppListCommand();
|
|
69
|
+
//# sourceMappingURL=enterpriseapp-list.js.map
|
|
@@ -0,0 +1,224 @@
|
|
|
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 _EntraGroupAddCommand_instances, _EntraGroupAddCommand_initOptions, _EntraGroupAddCommand_initValidators, _EntraGroupAddCommand_initTelemetry;
|
|
7
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
import aadCommands from '../../aadCommands.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import request from '../../../../request.js';
|
|
12
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
13
|
+
class EntraGroupAddCommand extends GraphCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.GROUP_ADD;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Creates a Microsoft Entra group';
|
|
19
|
+
}
|
|
20
|
+
alias() {
|
|
21
|
+
return [aadCommands.GROUP_ADD];
|
|
22
|
+
}
|
|
23
|
+
allowUnknownOptions() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
_EntraGroupAddCommand_instances.add(this);
|
|
29
|
+
__classPrivateFieldGet(this, _EntraGroupAddCommand_instances, "m", _EntraGroupAddCommand_initTelemetry).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _EntraGroupAddCommand_instances, "m", _EntraGroupAddCommand_initOptions).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _EntraGroupAddCommand_instances, "m", _EntraGroupAddCommand_initValidators).call(this);
|
|
32
|
+
}
|
|
33
|
+
async commandAction(logger, args) {
|
|
34
|
+
let group;
|
|
35
|
+
let ownerIds = [];
|
|
36
|
+
let memberIds = [];
|
|
37
|
+
try {
|
|
38
|
+
const manifest = this.createRequestBody(args.options);
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${this.resource}/v1.0/groups`,
|
|
41
|
+
headers: {
|
|
42
|
+
accept: 'application/json;odata.metadata=none'
|
|
43
|
+
},
|
|
44
|
+
responseType: 'json',
|
|
45
|
+
data: manifest
|
|
46
|
+
};
|
|
47
|
+
ownerIds = await this.getUserIds(logger, args.options.ownerIds, args.options.ownerUserNames);
|
|
48
|
+
memberIds = await this.getUserIds(logger, args.options.memberIds, args.options.memberUserNames);
|
|
49
|
+
group = await request.post(requestOptions);
|
|
50
|
+
if (ownerIds.length !== 0) {
|
|
51
|
+
await this.addUsers(group.id, 'owners', ownerIds);
|
|
52
|
+
}
|
|
53
|
+
if (memberIds.length !== 0) {
|
|
54
|
+
await this.addUsers(group.id, 'members', memberIds);
|
|
55
|
+
}
|
|
56
|
+
await logger.log(group);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
;
|
|
63
|
+
createRequestBody(options) {
|
|
64
|
+
const requestBody = {
|
|
65
|
+
displayName: options.displayName,
|
|
66
|
+
description: options.description,
|
|
67
|
+
mailNickName: options.mailNickname ?? this.generateMailNickname(),
|
|
68
|
+
visibility: options.visibility ?? 'Public',
|
|
69
|
+
groupTypes: options.type === 'microsoft365' ? ['Unified'] : [],
|
|
70
|
+
mailEnabled: options.type === 'security' ? false : true,
|
|
71
|
+
securityEnabled: true
|
|
72
|
+
};
|
|
73
|
+
this.addUnknownOptionsToPayload(requestBody, options);
|
|
74
|
+
return requestBody;
|
|
75
|
+
}
|
|
76
|
+
generateMailNickname() {
|
|
77
|
+
return `Group${Math.floor(Math.random() * 1000000)}`;
|
|
78
|
+
}
|
|
79
|
+
async getUserIds(logger, userIds, userNames) {
|
|
80
|
+
if (userIds) {
|
|
81
|
+
return userIds.split(',').map(o => o.trim());
|
|
82
|
+
}
|
|
83
|
+
if (!userNames) {
|
|
84
|
+
if (this.verbose) {
|
|
85
|
+
await logger.logToStderr('No users to validate, skipping.');
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
if (this.verbose) {
|
|
90
|
+
await logger.logToStderr('Retrieving user information.');
|
|
91
|
+
}
|
|
92
|
+
const userArr = userNames.split(',').map(o => o.trim());
|
|
93
|
+
if (this.verbose) {
|
|
94
|
+
await logger.logToStderr('Retrieving ID(s) of user(s)...');
|
|
95
|
+
}
|
|
96
|
+
return entraUser.getUserIdsByUpns(userArr);
|
|
97
|
+
}
|
|
98
|
+
async addUsers(groupId, role, userIds) {
|
|
99
|
+
for (let i = 0; i < userIds.length; i += 400) {
|
|
100
|
+
const userIdsBatch = userIds.slice(i, i + 400);
|
|
101
|
+
const requestOptions = {
|
|
102
|
+
url: `${this.resource}/v1.0/$batch`,
|
|
103
|
+
headers: {
|
|
104
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
105
|
+
},
|
|
106
|
+
responseType: 'json',
|
|
107
|
+
data: {
|
|
108
|
+
requests: []
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// only 20 requests per one batch are allowed
|
|
112
|
+
for (let j = 0; j < userIdsBatch.length; j += 20) {
|
|
113
|
+
// only 20 users can be added in one request
|
|
114
|
+
const userIdsChunk = userIdsBatch.slice(j, j + 20);
|
|
115
|
+
requestOptions.data.requests.push({
|
|
116
|
+
id: j + 1,
|
|
117
|
+
method: 'PATCH',
|
|
118
|
+
url: `/groups/${groupId}`,
|
|
119
|
+
headers: {
|
|
120
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
121
|
+
},
|
|
122
|
+
body: {
|
|
123
|
+
[`${role}@odata.bind`]: userIdsChunk.map(u => `${this.resource}/v1.0/directoryObjects/${u}`)
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const res = await request.post(requestOptions);
|
|
128
|
+
for (const response of res.responses) {
|
|
129
|
+
if (response.status !== 204) {
|
|
130
|
+
throw response.body;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
_EntraGroupAddCommand_instances = new WeakSet(), _EntraGroupAddCommand_initOptions = function _EntraGroupAddCommand_initOptions() {
|
|
137
|
+
this.options.unshift({
|
|
138
|
+
option: '-n, --displayName <displayName>'
|
|
139
|
+
}, {
|
|
140
|
+
option: '-d, --description [description]'
|
|
141
|
+
}, {
|
|
142
|
+
option: '-t, --type <type>',
|
|
143
|
+
autocomplete: ['microsoft365', 'security']
|
|
144
|
+
}, {
|
|
145
|
+
option: '-m, --mailNickname [mailNickname]'
|
|
146
|
+
}, {
|
|
147
|
+
option: '--ownerIds [ownerIds]'
|
|
148
|
+
}, {
|
|
149
|
+
option: '--ownerUserNames [ownerUserNames]'
|
|
150
|
+
}, {
|
|
151
|
+
option: '--memberIds [memberIds]'
|
|
152
|
+
}, {
|
|
153
|
+
option: '--memberUserNames [memberUserNames]'
|
|
154
|
+
}, {
|
|
155
|
+
option: '--visibility [visibility]',
|
|
156
|
+
autocomplete: ['Public', 'Private', 'HiddenMembership']
|
|
157
|
+
});
|
|
158
|
+
}, _EntraGroupAddCommand_initValidators = function _EntraGroupAddCommand_initValidators() {
|
|
159
|
+
this.validators.push(async (args) => {
|
|
160
|
+
if (args.options.displayName.length > 256) {
|
|
161
|
+
return `The maximum amount of characters for 'displayName' is 256.`;
|
|
162
|
+
}
|
|
163
|
+
if (args.options.mailNickname) {
|
|
164
|
+
if (!validation.isValidMailNickname(args.options.mailNickname)) {
|
|
165
|
+
return `Value for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \ [] " ; : <> , SPACE.`;
|
|
166
|
+
}
|
|
167
|
+
if (args.options.mailNickname.length > 64) {
|
|
168
|
+
return `The maximum amount of characters for 'mailNickname' is 64.`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (args.options.ownerIds) {
|
|
172
|
+
const ids = args.options.ownerIds.split(',').map(i => i.trim());
|
|
173
|
+
if (!validation.isValidGuidArray(ids)) {
|
|
174
|
+
const invalidGuid = ids.find(id => !validation.isValidGuid(id));
|
|
175
|
+
return `'${invalidGuid}' is not a valid GUID for option 'ownerIds'.`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (args.options.ownerUserNames) {
|
|
179
|
+
const isValidUserPrincipalNameArray = validation.isValidUserPrincipalNameArray(args.options.ownerUserNames.split(',').map(u => u.trim()));
|
|
180
|
+
if (isValidUserPrincipalNameArray !== true) {
|
|
181
|
+
return `User principal name '${isValidUserPrincipalNameArray}' is invalid for option 'ownerUserNames'.`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (args.options.memberIds) {
|
|
185
|
+
const ids = args.options.memberIds.split(',').map(i => i.trim());
|
|
186
|
+
if (!validation.isValidGuidArray(ids)) {
|
|
187
|
+
const invalidGuid = ids.find(id => !validation.isValidGuid(id));
|
|
188
|
+
return `'${invalidGuid}' is not a valid GUID for option 'memberIds'.`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (args.options.memberUserNames) {
|
|
192
|
+
const isValidUserPrincipalNameArray = validation.isValidUserPrincipalNameArray(args.options.memberUserNames.split(',').map(u => u.trim()));
|
|
193
|
+
if (isValidUserPrincipalNameArray !== true) {
|
|
194
|
+
return `User principal name '${isValidUserPrincipalNameArray}' is invalid for option 'memberUserNames'.`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (['microsoft365', 'security'].indexOf(args.options.type) === -1) {
|
|
198
|
+
return `Option 'type' must be one of the following values: microsoft365, security.`;
|
|
199
|
+
}
|
|
200
|
+
if (args.options.type === 'microsoft365' && !args.options.visibility) {
|
|
201
|
+
return `Option 'visibility' must be specified if the option 'type' is set to microsoft365`;
|
|
202
|
+
}
|
|
203
|
+
if (args.options.visibility && ['Public', 'Private', 'HiddenMembership'].indexOf(args.options.visibility) === -1) {
|
|
204
|
+
return `Option 'visibility' must be one of the following values: Public, Private, HiddenMembership.`;
|
|
205
|
+
}
|
|
206
|
+
return true;
|
|
207
|
+
});
|
|
208
|
+
}, _EntraGroupAddCommand_initTelemetry = function _EntraGroupAddCommand_initTelemetry() {
|
|
209
|
+
this.telemetry.push((args) => {
|
|
210
|
+
Object.assign(this.telemetryProperties, {
|
|
211
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
212
|
+
description: typeof args.options.description !== 'undefined',
|
|
213
|
+
type: typeof args.options.type !== 'undefined',
|
|
214
|
+
mailNickname: typeof args.options.mailNickname !== 'undefined',
|
|
215
|
+
ownerIds: typeof args.options.ownerIds !== 'undefined',
|
|
216
|
+
ownerUserNames: typeof args.options.ownerUserNames !== 'undefined',
|
|
217
|
+
memberIds: typeof args.options.memberIds !== 'undefined',
|
|
218
|
+
memberUserNames: typeof args.options.memberUserNames !== 'undefined',
|
|
219
|
+
visibility: typeof args.options.visibility !== 'undefined'
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
export default new EntraGroupAddCommand();
|
|
224
|
+
//# sourceMappingURL=group-add.js.map
|
|
@@ -6,7 +6,7 @@ class M365GroupReportActivityGroupCountsCommand extends PeriodBasedReport {
|
|
|
6
6
|
return commands.M365GROUP_REPORT_ACTIVITYGROUPCOUNTS;
|
|
7
7
|
}
|
|
8
8
|
get description() {
|
|
9
|
-
return 'Get the daily total number of groups and how many of them were active based on email conversations,
|
|
9
|
+
return 'Get the daily total number of groups and how many of them were active based on email conversations, Viva Engage posts, and SharePoint file activities';
|
|
10
10
|
}
|
|
11
11
|
alias() {
|
|
12
12
|
return [aadCommands.M365GROUP_REPORT_ACTIVITYGROUPCOUNTS];
|
|
@@ -5,12 +5,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _EntraUserGetCommand_instances, _EntraUserGetCommand_initTelemetry, _EntraUserGetCommand_initOptions, _EntraUserGetCommand_initValidators, _EntraUserGetCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
-
import { formatting } from '../../../../utils/formatting.js';
|
|
9
8
|
import { validation } from '../../../../utils/validation.js';
|
|
10
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
10
|
import commands from '../../commands.js';
|
|
12
|
-
import { cli } from '../../../../cli/cli.js';
|
|
13
11
|
import aadCommands from '../../aadCommands.js';
|
|
12
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
13
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
14
14
|
class EntraUserGetCommand extends GraphCommand {
|
|
15
15
|
get name() {
|
|
16
16
|
return commands.USER_GET;
|
|
@@ -30,50 +30,50 @@ class EntraUserGetCommand extends GraphCommand {
|
|
|
30
30
|
__classPrivateFieldGet(this, _EntraUserGetCommand_instances, "m", _EntraUserGetCommand_initOptionSets).call(this);
|
|
31
31
|
}
|
|
32
32
|
async commandAction(logger, args) {
|
|
33
|
-
const properties = args.options.properties ?
|
|
34
|
-
`&$select=${args.options.properties.split(',').map(p => formatting.encodeQueryParameter(p.trim())).join(',')}` :
|
|
35
|
-
'';
|
|
36
|
-
let requestUrl = `${this.resource}/v1.0/users`;
|
|
37
|
-
if (args.options.id) {
|
|
38
|
-
requestUrl += `?$filter=id eq '${formatting.encodeQueryParameter(args.options.id)}'${properties}`;
|
|
39
|
-
}
|
|
40
|
-
else if (args.options.userName) {
|
|
41
|
-
requestUrl += `?$filter=userPrincipalName eq '${formatting.encodeQueryParameter(args.options.userName)}'${properties}`;
|
|
42
|
-
}
|
|
43
|
-
else if (args.options.email) {
|
|
44
|
-
requestUrl += `?$filter=mail eq '${formatting.encodeQueryParameter(args.options.email)}'${properties}`;
|
|
45
|
-
}
|
|
46
|
-
if (args.options.withManager) {
|
|
47
|
-
requestUrl += '&$expand=manager($select=displayName,userPrincipalName,id,mail)';
|
|
48
|
-
}
|
|
49
|
-
const requestOptions = {
|
|
50
|
-
url: requestUrl,
|
|
51
|
-
headers: {
|
|
52
|
-
accept: 'application/json;odata.metadata=none'
|
|
53
|
-
},
|
|
54
|
-
responseType: 'json'
|
|
55
|
-
};
|
|
56
33
|
try {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (res.value.length === 0) {
|
|
62
|
-
throw `The specified user with ${identifier} does not exist`;
|
|
34
|
+
let userIdOrPrincipalName = args.options.id;
|
|
35
|
+
if (args.options.userName) {
|
|
36
|
+
// single user can be retrieved also by user principal name
|
|
37
|
+
userIdOrPrincipalName = formatting.encodeQueryParameter(args.options.userName);
|
|
63
38
|
}
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
const result = await cli.handleMultipleResultsFound(`Multiple users with ${identifier} found.`, resultAsKeyValuePair);
|
|
67
|
-
await logger.log(result);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
await logger.log(res.value[0]);
|
|
39
|
+
else if (args.options.email) {
|
|
40
|
+
userIdOrPrincipalName = await entraUser.getUserIdByEmail(args.options.email);
|
|
71
41
|
}
|
|
42
|
+
const requestUrl = this.getRequestUrl(userIdOrPrincipalName, args.options);
|
|
43
|
+
const requestOptions = {
|
|
44
|
+
url: requestUrl,
|
|
45
|
+
headers: {
|
|
46
|
+
accept: 'application/json;odata.metadata=none'
|
|
47
|
+
},
|
|
48
|
+
responseType: 'json'
|
|
49
|
+
};
|
|
50
|
+
const user = await request.get(requestOptions);
|
|
51
|
+
await logger.log(user);
|
|
72
52
|
}
|
|
73
53
|
catch (err) {
|
|
74
54
|
this.handleRejectedODataJsonPromise(err);
|
|
75
55
|
}
|
|
76
56
|
}
|
|
57
|
+
getRequestUrl(userIdOrPrincipalName, options) {
|
|
58
|
+
const queryParameters = [];
|
|
59
|
+
if (options.properties) {
|
|
60
|
+
const allProperties = options.properties.split(',');
|
|
61
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
62
|
+
if (selectProperties.length > 0) {
|
|
63
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (options.withManager) {
|
|
67
|
+
queryParameters.push('$expand=manager($select=displayName,userPrincipalName,id,mail)');
|
|
68
|
+
}
|
|
69
|
+
const queryString = queryParameters.length > 0
|
|
70
|
+
? `?${queryParameters.join('&')}`
|
|
71
|
+
: '';
|
|
72
|
+
// user principal name can start with $ but it violates the OData URL convention, so it must be enclosed in parenthesis and single quotes
|
|
73
|
+
return userIdOrPrincipalName.startsWith('%24')
|
|
74
|
+
? `${this.resource}/v1.0/users('${userIdOrPrincipalName}')${queryString}`
|
|
75
|
+
: `${this.resource}/v1.0/users/${userIdOrPrincipalName}${queryString}`;
|
|
76
|
+
}
|
|
77
77
|
}
|
|
78
78
|
_EntraUserGetCommand_instances = new WeakSet(), _EntraUserGetCommand_initTelemetry = function _EntraUserGetCommand_initTelemetry() {
|
|
79
79
|
this.telemetry.push((args) => {
|