@pnp/cli-microsoft365 7.5.0-beta.cae14d0 → 7.5.0
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/Dockerfile +0 -3
- package/README.md +2 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +171 -69
- package/dist/AuthServer.js +3 -3
- package/dist/Command.js +8 -5
- package/dist/auth/FileTokenStorage.js +4 -1
- package/dist/m365/base/AppCommand.js +2 -2
- package/dist/m365/base/PowerAppsCommand.js +2 -2
- package/dist/m365/base/PowerAutomateCommand.js +2 -2
- package/dist/m365/base/PowerPlatformCommand.js +2 -2
- package/dist/m365/base/SpoCommand.js +3 -3
- package/dist/m365/base/{YammerCommand.js → VivaEngageCommand.js} +2 -2
- package/dist/m365/cli/commands/cli-consent.js +5 -3
- package/dist/m365/cli/commands/cli-doctor.js +5 -5
- package/dist/m365/commands/ConnectionDetails.js +2 -0
- package/dist/m365/commands/login.js +26 -48
- package/dist/m365/commands/logout.js +2 -2
- package/dist/m365/commands/request.js +2 -2
- package/dist/m365/commands/status.js +15 -23
- package/dist/m365/connection/commands/connection-list.js +47 -0
- package/dist/m365/connection/commands/connection-remove.js +67 -0
- package/dist/m365/connection/commands/connection-set.js +56 -0
- package/dist/m365/connection/commands/connection-use.js +51 -0
- package/dist/m365/connection/commands.js +8 -0
- 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 +2 -2
- 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-license-list.js +1 -1
- package/dist/m365/entra/commands/user/user-registrationdetails-list.js +224 -0
- package/dist/m365/entra/commands/user/user-set.js +2 -2
- package/dist/m365/entra/commands.js +16 -0
- package/dist/m365/file/commands/convert/convert-pdf.js +1 -1
- package/dist/m365/file/commands/file-copy.js +151 -0
- package/dist/m365/file/commands.js +1 -0
- package/dist/m365/outlook/commands/mail/mail-send.js +1 -1
- package/dist/m365/outlook/commands/message/message-get.js +1 -1
- package/dist/m365/pa/commands/app/app-permission-ensure.js +1 -1
- package/dist/m365/pa/commands/app/app-permission-remove.js +1 -1
- package/dist/m365/planner/commands/roster/roster-plan-list.js +1 -1
- package/dist/m365/purview/commands/auditlog/auditlog-list.js +1 -1
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-get.js +1 -1
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-list.js +1 -1
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-policysettings-list.js +1 -1
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +4 -3
- package/dist/m365/spo/commands/spo-get.js +1 -1
- package/dist/m365/spo/commands/spo-search.js +52 -22
- package/dist/m365/spo/commands/spo-set.js +1 -1
- package/dist/m365/teams/commands/chat/chat-get.js +1 -1
- package/dist/m365/teams/commands/chat/chat-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-send.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-add.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-get.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-list.js +2 -2
- package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +1 -1
- package/dist/m365/tenant/commands/id/id-get.js +1 -1
- package/dist/m365/tenant/commands/info/info-get.js +1 -1
- package/dist/m365/util/commands/accesstoken/accesstoken-get.js +3 -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/request.js +1 -1
- package/dist/utils/spo.js +36 -14
- 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/connection/connection-list.mdx +100 -0
- package/docs/docs/cmd/connection/connection-remove.mdx +45 -0
- package/docs/docs/cmd/connection/connection-set.mdx +39 -0
- package/docs/docs/cmd/connection/connection-use.mdx +98 -0
- 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/login.mdx +15 -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/spo-search.mdx +6 -2
- 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 +4 -3
- 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,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) => {
|
|
@@ -33,7 +33,7 @@ class EntraUserLicenseListCommand extends GraphCommand {
|
|
|
33
33
|
__classPrivateFieldGet(this, _EntraUserLicenseListCommand_instances, "m", _EntraUserLicenseListCommand_initOptionSets).call(this);
|
|
34
34
|
}
|
|
35
35
|
async commandAction(logger, args) {
|
|
36
|
-
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.
|
|
36
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[this.resource].accessToken);
|
|
37
37
|
if (isAppOnlyAccessToken && !args.options.userId && !args.options.userName) {
|
|
38
38
|
this.handleError(`Specify at least 'userId' or 'userName' when using application permissions.`);
|
|
39
39
|
}
|
|
@@ -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 _EntraUserRegistrationDetailsListCommand_instances, _EntraUserRegistrationDetailsListCommand_initTelemetry, _EntraUserRegistrationDetailsListCommand_initOptions, _EntraUserRegistrationDetailsListCommand_initValidators;
|
|
7
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
import aadCommands from '../../aadCommands.js';
|
|
10
|
+
import { odata } from '../../../../utils/odata.js';
|
|
11
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
12
|
+
import { validation } from '../../../../utils/validation.js';
|
|
13
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
14
|
+
const authenticationMethods = ['push', 'oath', 'voiceMobile', 'voiceAlternateMobile', 'voiceOffice', 'sms', 'none'];
|
|
15
|
+
const methodsRegistered = ['mobilePhone', 'email', 'fido2', 'microsoftAuthenticatorPush', 'softwareOneTimePasscode'];
|
|
16
|
+
class EntraUserRegistrationDetailsListCommand extends GraphCommand {
|
|
17
|
+
get name() {
|
|
18
|
+
return commands.USER_REGISTRATIONDETAILS_LIST;
|
|
19
|
+
}
|
|
20
|
+
get description() {
|
|
21
|
+
return 'Retrieves a list of the authentication methods registered for users';
|
|
22
|
+
}
|
|
23
|
+
alias() {
|
|
24
|
+
return [aadCommands.USER_REGISTRATIONDETAILS_LIST];
|
|
25
|
+
}
|
|
26
|
+
defaultProperties() {
|
|
27
|
+
return ['userPrincipalName', 'methodsRegistered', 'lastUpdatedDateTime'];
|
|
28
|
+
}
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
_EntraUserRegistrationDetailsListCommand_instances.add(this);
|
|
32
|
+
__classPrivateFieldGet(this, _EntraUserRegistrationDetailsListCommand_instances, "m", _EntraUserRegistrationDetailsListCommand_initTelemetry).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _EntraUserRegistrationDetailsListCommand_instances, "m", _EntraUserRegistrationDetailsListCommand_initOptions).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _EntraUserRegistrationDetailsListCommand_instances, "m", _EntraUserRegistrationDetailsListCommand_initValidators).call(this);
|
|
35
|
+
}
|
|
36
|
+
async commandAction(logger, args) {
|
|
37
|
+
try {
|
|
38
|
+
let userUpns = [];
|
|
39
|
+
if (args.options.userIds) {
|
|
40
|
+
const ids = args.options.userIds.split(',').map(m => m.trim());
|
|
41
|
+
userUpns = await Promise.all(ids.map(id => entraUser.getUpnByUserId(id)));
|
|
42
|
+
}
|
|
43
|
+
const requestUrl = this.getRequestUrl(args.options, userUpns);
|
|
44
|
+
const result = await odata.getAllItems(requestUrl);
|
|
45
|
+
await logger.log(result);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
this.handleRejectedODataJsonPromise(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getRequestUrl(options, userUpns) {
|
|
52
|
+
const queryParameters = [];
|
|
53
|
+
if (options.properties) {
|
|
54
|
+
queryParameters.push(`$select=${options.properties}`);
|
|
55
|
+
}
|
|
56
|
+
const filters = [];
|
|
57
|
+
if (options.isAdmin !== undefined) {
|
|
58
|
+
filters.push(`isAdmin eq ${options.isAdmin}`);
|
|
59
|
+
}
|
|
60
|
+
if (options.isMfaCapable !== undefined) {
|
|
61
|
+
filters.push(`isMfaCapable eq ${options.isMfaCapable}`);
|
|
62
|
+
}
|
|
63
|
+
if (options.isMfaRegistered !== undefined) {
|
|
64
|
+
filters.push(`isMfaRegistered eq ${options.isMfaRegistered}`);
|
|
65
|
+
}
|
|
66
|
+
if (options.isPasswordlessCapable !== undefined) {
|
|
67
|
+
filters.push(`isPasswordlessCapable eq ${options.isPasswordlessCapable}`);
|
|
68
|
+
}
|
|
69
|
+
if (options.isSelfServicePasswordResetCapable !== undefined) {
|
|
70
|
+
filters.push(`isSelfServicePasswordResetCapable eq ${options.isSelfServicePasswordResetCapable}`);
|
|
71
|
+
}
|
|
72
|
+
if (options.isSelfServicePasswordResetEnabled !== undefined) {
|
|
73
|
+
filters.push(`isSelfServicePasswordResetEnabled eq ${options.isSelfServicePasswordResetEnabled}`);
|
|
74
|
+
}
|
|
75
|
+
if (options.isSelfServicePasswordResetRegistered !== undefined) {
|
|
76
|
+
filters.push(`isSelfServicePasswordResetRegistered eq ${options.isSelfServicePasswordResetRegistered}`);
|
|
77
|
+
}
|
|
78
|
+
if (options.isSystemPreferredAuthenticationMethodEnabled !== undefined) {
|
|
79
|
+
filters.push(`isSystemPreferredAuthenticationMethodEnabled eq ${options.isSystemPreferredAuthenticationMethodEnabled}`);
|
|
80
|
+
}
|
|
81
|
+
const methodsRegistered = options.methodsRegistered?.split(',').map(method => `methodsRegistered/any(m:m eq '${method.trim()}')`);
|
|
82
|
+
const methodsRegisteredFilter = methodsRegistered?.join(' or ');
|
|
83
|
+
if (methodsRegisteredFilter) {
|
|
84
|
+
filters.push(`(${methodsRegisteredFilter})`);
|
|
85
|
+
}
|
|
86
|
+
const systemPreferredAuthenticationMethods = options.systemPreferredAuthenticationMethods?.split(',').map(method => `systemPreferredAuthenticationMethods/any(m:m eq '${method.trim()}')`);
|
|
87
|
+
const systemPreferredAuthenticationMethodsFilter = systemPreferredAuthenticationMethods?.join(' or ');
|
|
88
|
+
if (systemPreferredAuthenticationMethodsFilter) {
|
|
89
|
+
filters.push(`(${systemPreferredAuthenticationMethodsFilter})`);
|
|
90
|
+
}
|
|
91
|
+
const userUPNs = [];
|
|
92
|
+
if (userUpns.length > 0) {
|
|
93
|
+
userUpns.forEach(upn => {
|
|
94
|
+
userUPNs.push(`userPrincipalName eq '${formatting.encodeQueryParameter(upn)}'`);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (options.userPrincipalNames) {
|
|
98
|
+
const upns = options.userPrincipalNames.split(',').map(m => m.trim());
|
|
99
|
+
upns.forEach(upn => {
|
|
100
|
+
userUPNs.push(`userPrincipalName eq '${formatting.encodeQueryParameter(upn)}'`);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (userUPNs.length > 0) {
|
|
104
|
+
filters.push(`(${userUPNs.join(' or ')})`);
|
|
105
|
+
}
|
|
106
|
+
const userPreferredMethodForSecondaryAuthentication = options.userPreferredMethodForSecondaryAuthentication?.split(',').map(method => `userPreferredMethodForSecondaryAuthentication eq '${method.trim()}'`);
|
|
107
|
+
const userPreferredMethodForSecondaryAuthenticationFilter = userPreferredMethodForSecondaryAuthentication?.join(' or ');
|
|
108
|
+
if (userPreferredMethodForSecondaryAuthenticationFilter) {
|
|
109
|
+
filters.push(`(${userPreferredMethodForSecondaryAuthenticationFilter})`);
|
|
110
|
+
}
|
|
111
|
+
if (options.userType) {
|
|
112
|
+
filters.push(`userType eq '${options.userType}'`);
|
|
113
|
+
}
|
|
114
|
+
if (filters.length > 0) {
|
|
115
|
+
queryParameters.push(`$filter=${filters.join(' and ')}`);
|
|
116
|
+
}
|
|
117
|
+
const queryString = queryParameters.length > 0
|
|
118
|
+
? `?${queryParameters.join('&')}`
|
|
119
|
+
: '';
|
|
120
|
+
return `${this.resource}/v1.0/reports/authenticationMethods/userRegistrationDetails${queryString}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
_EntraUserRegistrationDetailsListCommand_instances = new WeakSet(), _EntraUserRegistrationDetailsListCommand_initTelemetry = function _EntraUserRegistrationDetailsListCommand_initTelemetry() {
|
|
124
|
+
this.telemetry.push((args) => {
|
|
125
|
+
Object.assign(this.telemetryProperties, {
|
|
126
|
+
isAdmin: !!args.options.isAdmin,
|
|
127
|
+
userType: typeof args.options.userType !== 'undefined',
|
|
128
|
+
userPreferredMethodForSecondaryAuthentication: typeof args.options.userPreferredMethodForSecondaryAuthentication !== 'undefined',
|
|
129
|
+
systemPreferredAuthenticationMethods: typeof args.options.systemPreferredAuthenticationMethods !== 'undefined',
|
|
130
|
+
isSelfServicePasswordResetRegistered: !!args.options.isSelfServicePasswordResetRegistered,
|
|
131
|
+
isSelfServicePasswordResetEnabled: !!args.options.isSelfServicePasswordResetEnabled,
|
|
132
|
+
isSelfServicePasswordResetCapable: !!args.options.isSelfServicePasswordResetCapable,
|
|
133
|
+
isMfaRegistered: !!args.options.isMfaRegistered,
|
|
134
|
+
isMfaCapable: !!args.options.isMfaCapable,
|
|
135
|
+
isPasswordlessCapable: !!args.options.isPasswordlessCapable,
|
|
136
|
+
isSystemPreferredAuthenticationMethodEnabled: !!args.options.isSystemPreferredAuthenticationMethodEnabled,
|
|
137
|
+
methodsRegistered: typeof args.options.methodsRegistered !== 'undefined',
|
|
138
|
+
userIds: typeof args.options.userIds !== 'undefined',
|
|
139
|
+
userPrincipalNames: typeof args.options.userPrincipalNames !== 'undefined',
|
|
140
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}, _EntraUserRegistrationDetailsListCommand_initOptions = function _EntraUserRegistrationDetailsListCommand_initOptions() {
|
|
144
|
+
this.options.unshift({
|
|
145
|
+
option: '--isAdmin [isAdmin]'
|
|
146
|
+
}, {
|
|
147
|
+
option: '--userType [userType]',
|
|
148
|
+
autocomplete: ['member', 'guest']
|
|
149
|
+
}, {
|
|
150
|
+
option: '--userPreferredMethodForSecondaryAuthentication [userPreferredMethodForSecondaryAuthentication ]',
|
|
151
|
+
autocomplete: authenticationMethods
|
|
152
|
+
}, {
|
|
153
|
+
option: '--systemPreferredAuthenticationMethods [systemPreferredAuthenticationMethods ]',
|
|
154
|
+
autocomplete: authenticationMethods
|
|
155
|
+
}, {
|
|
156
|
+
option: '--isSelfServicePasswordResetRegistered [isSelfServicePasswordResetRegistered]'
|
|
157
|
+
}, {
|
|
158
|
+
option: '--isSelfServicePasswordResetEnabled [isSelfServicePasswordResetEnabled]'
|
|
159
|
+
}, {
|
|
160
|
+
option: '--isSelfServicePasswordResetCapable [isSelfServicePasswordResetCapable]'
|
|
161
|
+
}, {
|
|
162
|
+
option: '--isMfaRegistered [isMfaRegistered]'
|
|
163
|
+
}, {
|
|
164
|
+
option: '--isMfaCapable [isMfaCapable]'
|
|
165
|
+
}, {
|
|
166
|
+
option: '--isPasswordlessCapable [isPasswordlessCapable]'
|
|
167
|
+
}, {
|
|
168
|
+
option: '--isSystemPreferredAuthenticationMethodEnabled [isSystemPreferredAuthenticationMethodEnabled]'
|
|
169
|
+
}, {
|
|
170
|
+
option: '--methodsRegistered [methodsRegistered]',
|
|
171
|
+
autocomplete: methodsRegistered
|
|
172
|
+
}, {
|
|
173
|
+
option: '--userIds [userIds]'
|
|
174
|
+
}, {
|
|
175
|
+
option: '--userPrincipalNames [userPrincipalNames]'
|
|
176
|
+
}, {
|
|
177
|
+
option: '-p, --properties [properties]'
|
|
178
|
+
});
|
|
179
|
+
}, _EntraUserRegistrationDetailsListCommand_initValidators = function _EntraUserRegistrationDetailsListCommand_initValidators() {
|
|
180
|
+
this.validators.push(async (args) => {
|
|
181
|
+
if (args.options.userType) {
|
|
182
|
+
if (['member', 'guest'].every(type => type !== args.options.userType)) {
|
|
183
|
+
return `'${args.options.userType}' is not a valid userType value. Allowed values member, guest`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (args.options.userPreferredMethodForSecondaryAuthentication) {
|
|
187
|
+
const methods = args.options.userPreferredMethodForSecondaryAuthentication.split(',').map(m => m.trim());
|
|
188
|
+
const invalidMethods = methods.filter(m => !authenticationMethods.includes(m));
|
|
189
|
+
if (invalidMethods.length > 0) {
|
|
190
|
+
return `'${args.options.userPreferredMethodForSecondaryAuthentication}' is not a valid userPreferredMethodForSecondaryAuthentication value. Invalid values: ${invalidMethods.join(',')}. Allowed values ${authenticationMethods.join(', ')}`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (args.options.systemPreferredAuthenticationMethods) {
|
|
194
|
+
const methods = args.options.systemPreferredAuthenticationMethods.split(',').map(m => m.trim());
|
|
195
|
+
const invalidMethods = methods.filter(m => !authenticationMethods.includes(m));
|
|
196
|
+
if (invalidMethods.length > 0) {
|
|
197
|
+
return `'${args.options.systemPreferredAuthenticationMethods}' is not a valid systemPreferredAuthenticationMethods value. Invalid values: ${invalidMethods.join(',')}. Allowed values ${authenticationMethods.join(', ')}`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (args.options.methodsRegistered) {
|
|
201
|
+
const methods = args.options.methodsRegistered.split(',').map(m => m.trim());
|
|
202
|
+
const invalidMethods = methods.filter(m => !methodsRegistered.includes(m));
|
|
203
|
+
if (invalidMethods.length > 0) {
|
|
204
|
+
return `'${args.options.methodsRegistered}' is not a valid methodsRegistered value. Invalid values: ${invalidMethods.join(',')}. Allowed values ${methodsRegistered.join(', ')}`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (args.options.userIds) {
|
|
208
|
+
const ids = args.options.userIds.split(',').map(i => i.trim());
|
|
209
|
+
if (!validation.isValidGuidArray(ids)) {
|
|
210
|
+
const invalidGuid = ids.find(id => !validation.isValidGuid(id));
|
|
211
|
+
return `'${invalidGuid}' is not a valid GUID for option 'userIds'.`;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (args.options.userPrincipalNames) {
|
|
215
|
+
const isValidUserPrincipalNameArray = validation.isValidUserPrincipalNameArray(args.options.userPrincipalNames.split(',').map(u => u.trim()));
|
|
216
|
+
if (isValidUserPrincipalNameArray !== true) {
|
|
217
|
+
return `User principal name '${isValidUserPrincipalNameArray}' is invalid for option 'userPrincipalNames'.`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
export default new EntraUserRegistrationDetailsListCommand();
|
|
224
|
+
//# sourceMappingURL=user-registrationdetails-list.js.map
|
|
@@ -37,10 +37,10 @@ class EntraUserSetCommand extends GraphCommand {
|
|
|
37
37
|
async commandAction(logger, args) {
|
|
38
38
|
try {
|
|
39
39
|
if (args.options.currentPassword) {
|
|
40
|
-
if (args.options.id && args.options.id !== accessToken.getUserIdFromAccessToken(auth.
|
|
40
|
+
if (args.options.id && args.options.id !== accessToken.getUserIdFromAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken)) {
|
|
41
41
|
throw `You can only change your own password. Please use --id @meId to reference to your own userId`;
|
|
42
42
|
}
|
|
43
|
-
else if (args.options.userName && args.options.userName.toLowerCase() !== accessToken.getUserNameFromAccessToken(auth.
|
|
43
|
+
else if (args.options.userName && args.options.userName.toLowerCase() !== accessToken.getUserNameFromAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken).toLowerCase()) {
|
|
44
44
|
throw 'You can only change your own password. Please use --userName @meUserName to reference to your own user principal name';
|
|
45
45
|
}
|
|
46
46
|
}
|