@pnp/cli-microsoft365 5.0.0-beta.2e2ba7d → 5.0.0-beta.30c8613
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/.devcontainer/devcontainer.json +13 -2
- package/.eslintrc.js +2 -0
- package/.mocharc.json +9 -0
- package/README.md +3 -3
- package/dist/Command.js +1 -1
- package/dist/Utils.js +7 -0
- package/dist/api.d.ts +11 -0
- package/dist/api.js +17 -0
- package/dist/appInsights.js +2 -1
- package/dist/cli/Cli.js +38 -6
- package/dist/m365/aad/commands/app/app-add.js +43 -7
- package/dist/m365/aad/commands/app/app-delete.js +123 -0
- package/dist/m365/aad/commands/app/app-get.js +56 -11
- package/dist/m365/aad/commands/app/app-set.js +98 -3
- package/dist/m365/aad/commands/group/group-list.js +54 -0
- package/dist/m365/aad/commands/o365group/{Group.js → GroupExtended.js} +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +41 -0
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +3 -3
- package/dist/m365/aad/commands/user/user-get.js +33 -6
- package/dist/m365/aad/commands/user/user-hibp.js +67 -0
- package/dist/m365/aad/commands/user/user-list.js +7 -4
- package/dist/m365/aad/commands/user/user-password-validate.js +42 -0
- package/dist/m365/aad/commands.js +5 -0
- package/dist/m365/app/commands/permission/permission-list.js +266 -0
- package/dist/m365/app/commands.js +7 -0
- package/dist/m365/base/AppCommand.js +76 -0
- package/dist/m365/cli/commands/config/config-set.js +4 -1
- package/dist/m365/flow/commands/flow-get.js +2 -2
- package/dist/m365/outlook/commands/room/room-list.js +43 -0
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +25 -0
- package/dist/m365/outlook/commands.js +2 -0
- package/dist/m365/pa/cds-project-mutator.js +1 -1
- package/dist/m365/pa/commands/app/app-list.js +28 -1
- package/dist/m365/{aad/commands/o365group/GroupUser.js → planner/AppliedCategories.js} +1 -1
- package/dist/m365/planner/commands/task/task-add.js +288 -0
- package/dist/m365/planner/commands/task/task-details-get.js +39 -0
- package/dist/m365/planner/commands/task/task-get.js +37 -0
- package/dist/m365/planner/commands/task/task-list.js +37 -7
- package/dist/m365/planner/commands/task/task-set.js +357 -0
- package/dist/m365/planner/commands.js +5 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014008_CODE_launch_hostedWorkbench_type.js +62 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.14.0-beta.4.js → upgrade-1.14.0.js} +27 -25
- package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
- package/dist/m365/spfx/commands/spfx-doctor.js +25 -6
- package/dist/m365/spo/commands/group/group-user-add.js +74 -16
- package/dist/m365/spo/commands/group/group-user-remove.js +100 -0
- package/dist/m365/spo/commands/site/site-ensure.js +1 -1
- package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +76 -0
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/app/app-install.js +75 -21
- package/dist/m365/teams/commands/app/app-list.js +9 -6
- package/dist/m365/teams/commands/channel/channel-get.js +29 -7
- package/dist/m365/teams/commands/chat/chat-list.js +43 -0
- package/dist/m365/teams/commands/chat/chat-member-list.js +42 -0
- package/dist/m365/teams/commands/chat/chat-message-list.js +60 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +225 -0
- package/dist/m365/teams/commands/message/message-get.js +1 -1
- package/dist/m365/teams/commands/tab/tab-get.js +9 -6
- package/dist/m365/teams/commands.js +4 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +57 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +56 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +39 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +38 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +51 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +38 -0
- package/dist/m365/tenant/commands.js +6 -0
- package/dist/request.js +9 -4
- package/dist/settingsNames.js +6 -1
- package/docs/docs/cmd/_global.md +2 -2
- package/docs/docs/cmd/aad/app/app-delete.md +51 -0
- package/docs/docs/cmd/aad/app/app-get.md +12 -1
- package/docs/docs/cmd/aad/app/app-set.md +21 -0
- package/docs/docs/cmd/aad/group/group-list.md +30 -0
- package/docs/docs/cmd/aad/o365group/o365group-conversation-list.md +24 -0
- package/docs/docs/cmd/aad/user/user-get.md +13 -4
- package/docs/docs/cmd/aad/user/user-hibp.md +46 -0
- package/docs/docs/cmd/aad/user/user-list.md +9 -0
- package/docs/docs/cmd/aad/user/user-password-validate.md +29 -0
- package/docs/docs/cmd/app/permission/permission-list.md +36 -0
- package/docs/docs/cmd/outlook/room/room-list.md +30 -0
- package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +21 -0
- package/docs/docs/cmd/pa/app/app-list.md +17 -1
- package/docs/docs/cmd/planner/task/task-add.md +78 -0
- package/docs/docs/cmd/planner/task/task-details-get.md +24 -0
- package/docs/docs/cmd/planner/task/task-get.md +29 -0
- package/docs/docs/cmd/planner/task/task-list.md +5 -0
- package/docs/docs/cmd/planner/task/task-set.md +99 -0
- package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +3 -3
- package/docs/docs/cmd/spfx/project/project-externalize.md +1 -1
- package/docs/docs/cmd/spfx/project/project-rename.md +1 -1
- package/docs/docs/cmd/spfx/project/project-upgrade.md +8 -8
- package/docs/docs/cmd/spfx/spfx-doctor.md +1 -1
- package/docs/docs/cmd/spo/group/group-user-add.md +28 -6
- package/docs/docs/cmd/spo/group/group-user-remove.md +39 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-list.md +40 -0
- package/docs/docs/cmd/teams/app/app-install.md +22 -4
- package/docs/docs/cmd/teams/channel/channel-get.md +11 -2
- package/docs/docs/cmd/teams/chat/chat-list.md +30 -0
- package/docs/docs/cmd/teams/chat/chat-member-list.md +24 -0
- package/docs/docs/cmd/teams/chat/chat-message-list.md +24 -0
- package/docs/docs/cmd/teams/chat/chat-message-send.md +55 -0
- package/docs/docs/cmd/teams/message/message-get.md +0 -3
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +33 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +30 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +24 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +34 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +28 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +34 -0
- package/npm-shrinkwrap.json +1327 -1497
- package/package.json +38 -27
- package/dist/m365/base/AadCommand.js +0 -10
|
@@ -15,6 +15,9 @@ class AadAppSetCommand extends GraphCommand_1.default {
|
|
|
15
15
|
telemetryProps.appId = typeof args.options.appId !== 'undefined';
|
|
16
16
|
telemetryProps.objectId = typeof args.options.objectId !== 'undefined';
|
|
17
17
|
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
18
|
+
telemetryProps.platform = typeof args.options.platform !== 'undefined';
|
|
19
|
+
telemetryProps.redirectUris = typeof args.options.redirectUris !== 'undefined';
|
|
20
|
+
telemetryProps.redirectUrisToRemove = typeof args.options.redirectUrisToRemove !== 'undefined';
|
|
18
21
|
telemetryProps.uri = typeof args.options.uri !== 'undefined';
|
|
19
22
|
return telemetryProps;
|
|
20
23
|
}
|
|
@@ -22,6 +25,7 @@ class AadAppSetCommand extends GraphCommand_1.default {
|
|
|
22
25
|
this
|
|
23
26
|
.getAppObjectId(args, logger)
|
|
24
27
|
.then(objectId => this.configureUri(args, objectId, logger))
|
|
28
|
+
.then(objectId => this.configureRedirectUris(args, objectId, logger))
|
|
25
29
|
.then(_ => cb(), (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
|
|
26
30
|
}
|
|
27
31
|
getAppObjectId(args, logger) {
|
|
@@ -57,7 +61,7 @@ class AadAppSetCommand extends GraphCommand_1.default {
|
|
|
57
61
|
}
|
|
58
62
|
configureUri(args, objectId, logger) {
|
|
59
63
|
if (!args.options.uri) {
|
|
60
|
-
return Promise.resolve();
|
|
64
|
+
return Promise.resolve(objectId);
|
|
61
65
|
}
|
|
62
66
|
if (this.verbose) {
|
|
63
67
|
logger.logToStderr(`Configuring Azure AD application ID URI...`);
|
|
@@ -73,14 +77,97 @@ class AadAppSetCommand extends GraphCommand_1.default {
|
|
|
73
77
|
responseType: 'json',
|
|
74
78
|
data: applicationInfo
|
|
75
79
|
};
|
|
76
|
-
return request_1.default
|
|
80
|
+
return request_1.default
|
|
81
|
+
.patch(requestOptions)
|
|
82
|
+
.then(_ => Promise.resolve(objectId));
|
|
83
|
+
}
|
|
84
|
+
configureRedirectUris(args, objectId, logger) {
|
|
85
|
+
if (!args.options.redirectUris && !args.options.redirectUrisToRemove) {
|
|
86
|
+
return Promise.resolve(objectId);
|
|
87
|
+
}
|
|
88
|
+
if (this.verbose) {
|
|
89
|
+
logger.logToStderr(`Configuring Azure AD application redirect URIs...`);
|
|
90
|
+
}
|
|
91
|
+
const getAppRequestOptions = {
|
|
92
|
+
url: `${this.resource}/v1.0/myorganization/applications/${objectId}`,
|
|
93
|
+
headers: {
|
|
94
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
95
|
+
},
|
|
96
|
+
responseType: 'json'
|
|
97
|
+
};
|
|
98
|
+
return request_1.default
|
|
99
|
+
.get(getAppRequestOptions)
|
|
100
|
+
.then((application) => {
|
|
101
|
+
const publicClientRedirectUris = application.publicClient.redirectUris;
|
|
102
|
+
const spaRedirectUris = application.spa.redirectUris;
|
|
103
|
+
const webRedirectUris = application.web.redirectUris;
|
|
104
|
+
// start with existing redirect URIs
|
|
105
|
+
const applicationPatch = {
|
|
106
|
+
publicClient: {
|
|
107
|
+
redirectUris: publicClientRedirectUris
|
|
108
|
+
},
|
|
109
|
+
spa: {
|
|
110
|
+
redirectUris: spaRedirectUris
|
|
111
|
+
},
|
|
112
|
+
web: {
|
|
113
|
+
redirectUris: webRedirectUris
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
if (args.options.redirectUrisToRemove) {
|
|
117
|
+
// remove redirect URIs from all platforms
|
|
118
|
+
const redirectUrisToRemove = args.options.redirectUrisToRemove
|
|
119
|
+
.split(',')
|
|
120
|
+
.map(u => u.trim());
|
|
121
|
+
applicationPatch.publicClient.redirectUris =
|
|
122
|
+
publicClientRedirectUris.filter(u => !redirectUrisToRemove.includes(u));
|
|
123
|
+
applicationPatch.spa.redirectUris =
|
|
124
|
+
spaRedirectUris.filter(u => !redirectUrisToRemove.includes(u));
|
|
125
|
+
applicationPatch.web.redirectUris =
|
|
126
|
+
webRedirectUris.filter(u => !redirectUrisToRemove.includes(u));
|
|
127
|
+
}
|
|
128
|
+
if (args.options.redirectUris) {
|
|
129
|
+
const urlsToAdd = args.options.redirectUris
|
|
130
|
+
.split(',')
|
|
131
|
+
.map(u => u.trim());
|
|
132
|
+
// add new redirect URIs. If the URI is already present, it will be ignored
|
|
133
|
+
switch (args.options.platform) {
|
|
134
|
+
case 'spa':
|
|
135
|
+
applicationPatch.spa.redirectUris
|
|
136
|
+
.push(...urlsToAdd.filter(u => !spaRedirectUris.includes(u)));
|
|
137
|
+
break;
|
|
138
|
+
case 'publicClient':
|
|
139
|
+
applicationPatch.publicClient.redirectUris
|
|
140
|
+
.push(...urlsToAdd.filter(u => !publicClientRedirectUris.includes(u)));
|
|
141
|
+
break;
|
|
142
|
+
case 'web':
|
|
143
|
+
applicationPatch.web.redirectUris
|
|
144
|
+
.push(...urlsToAdd.filter(u => !webRedirectUris.includes(u)));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const requestOptions = {
|
|
148
|
+
url: `${this.resource}/v1.0/myorganization/applications/${objectId}`,
|
|
149
|
+
headers: {
|
|
150
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
151
|
+
},
|
|
152
|
+
responseType: 'json',
|
|
153
|
+
data: applicationPatch
|
|
154
|
+
};
|
|
155
|
+
return request_1.default.patch(requestOptions);
|
|
156
|
+
})
|
|
157
|
+
.then(_ => Promise.resolve(objectId));
|
|
77
158
|
}
|
|
78
159
|
options() {
|
|
79
160
|
const options = [
|
|
80
161
|
{ option: '--appId [appId]' },
|
|
81
162
|
{ option: '--objectId [objectId]' },
|
|
82
163
|
{ option: '-n, --name [name]' },
|
|
83
|
-
{ option: '-u, --uri [uri]' }
|
|
164
|
+
{ option: '-u, --uri [uri]' },
|
|
165
|
+
{ option: '-r, --redirectUris [redirectUris]' },
|
|
166
|
+
{
|
|
167
|
+
option: '--platform [platform]',
|
|
168
|
+
autocomplete: AadAppSetCommand.aadApplicationPlatform
|
|
169
|
+
},
|
|
170
|
+
{ option: '--redirectUrisToRemove [redirectUrisToRemove]' }
|
|
84
171
|
];
|
|
85
172
|
const parentOptions = super.options();
|
|
86
173
|
return options.concat(parentOptions);
|
|
@@ -96,8 +183,16 @@ class AadAppSetCommand extends GraphCommand_1.default {
|
|
|
96
183
|
(args.options.objectId && args.options.name)) {
|
|
97
184
|
return 'Specify either appId, objectId or name but not both';
|
|
98
185
|
}
|
|
186
|
+
if (args.options.redirectUris && !args.options.platform) {
|
|
187
|
+
return `When you specify redirectUris you also need to specify platform`;
|
|
188
|
+
}
|
|
189
|
+
if (args.options.platform &&
|
|
190
|
+
AadAppSetCommand.aadApplicationPlatform.indexOf(args.options.platform) < 0) {
|
|
191
|
+
return `${args.options.platform} is not a valid value for platform. Allowed values are ${AadAppSetCommand.aadApplicationPlatform.join(', ')}`;
|
|
192
|
+
}
|
|
99
193
|
return true;
|
|
100
194
|
}
|
|
101
195
|
}
|
|
196
|
+
AadAppSetCommand.aadApplicationPlatform = ['spa', 'web', 'publicClient'];
|
|
102
197
|
module.exports = new AadAppSetCommand();
|
|
103
198
|
//# sourceMappingURL=app-set.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
|
|
4
|
+
const commands_1 = require("../../commands");
|
|
5
|
+
class AadGroupListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
6
|
+
get name() {
|
|
7
|
+
return commands_1.default.GROUP_LIST;
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'Lists all groups defined in Azure Active Directory.';
|
|
11
|
+
}
|
|
12
|
+
getTelemetryProperties(args) {
|
|
13
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
14
|
+
telemetryProps.deleted = args.options.deleted;
|
|
15
|
+
return telemetryProps;
|
|
16
|
+
}
|
|
17
|
+
defaultProperties() {
|
|
18
|
+
return ['id', 'displayName', 'groupType'];
|
|
19
|
+
}
|
|
20
|
+
commandAction(logger, args, cb) {
|
|
21
|
+
const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.group' : 'groups';
|
|
22
|
+
this
|
|
23
|
+
.getAllItems(`${this.resource}/v1.0/${endpoint}`, logger, true)
|
|
24
|
+
.then(() => {
|
|
25
|
+
if (args.options.output === 'text') {
|
|
26
|
+
this.items.forEach((group) => {
|
|
27
|
+
if (group.groupTypes && group.groupTypes.length > 0 && group.groupTypes[0] === 'Unified') {
|
|
28
|
+
group.groupType = 'Microsoft 365';
|
|
29
|
+
}
|
|
30
|
+
else if (group.mailEnabled && group.securityEnabled) {
|
|
31
|
+
group.groupType = 'Mail enabled security';
|
|
32
|
+
}
|
|
33
|
+
else if (group.securityEnabled) {
|
|
34
|
+
group.groupType = 'Security';
|
|
35
|
+
}
|
|
36
|
+
else if (group.mailEnabled) {
|
|
37
|
+
group.groupType = 'Distribution';
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
logger.log(this.items);
|
|
42
|
+
cb();
|
|
43
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
44
|
+
}
|
|
45
|
+
options() {
|
|
46
|
+
const options = [
|
|
47
|
+
{ option: '-d, --deleted' }
|
|
48
|
+
];
|
|
49
|
+
const parentOptions = super.options();
|
|
50
|
+
return options.concat(parentOptions);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
module.exports = new AadGroupListCommand();
|
|
54
|
+
//# sourceMappingURL=group-list.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Utils_1 = require("../../../../Utils");
|
|
4
|
+
const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class AadO365GroupConversationListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.O365GROUP_CONVERSATION_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists conversations for the specified Microsoft 365 group';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['topic', 'lastDeliveredDateTime', 'id'];
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
this
|
|
18
|
+
.getAllItems(`${this.resource}/v1.0/groups/${args.options.groupId}/conversations`, logger, true)
|
|
19
|
+
.then(() => {
|
|
20
|
+
logger.log(this.items);
|
|
21
|
+
cb();
|
|
22
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
23
|
+
}
|
|
24
|
+
options() {
|
|
25
|
+
const options = [
|
|
26
|
+
{
|
|
27
|
+
option: '-i, --groupId <groupId>'
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
const parentOptions = super.options();
|
|
31
|
+
return options.concat(parentOptions);
|
|
32
|
+
}
|
|
33
|
+
validate(args) {
|
|
34
|
+
if (!Utils_1.default.isValidGuid(args.options.groupId)) {
|
|
35
|
+
return `${args.options.groupId} is not a valid GUID`;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
module.exports = new AadO365GroupConversationListCommand();
|
|
41
|
+
//# sourceMappingURL=o365group-conversation-list.js.map
|
|
@@ -37,14 +37,14 @@ class AadO365GroupUserSetCommand extends GraphItemsListCommand_1.GraphItemsListC
|
|
|
37
37
|
logger.logToStderr(this.items);
|
|
38
38
|
logger.logToStderr('');
|
|
39
39
|
}
|
|
40
|
-
if (this.items.filter(i =>
|
|
40
|
+
if (this.items.filter(i => args.options.userName.toUpperCase() === i.userPrincipalName.toUpperCase()).length <= 0) {
|
|
41
41
|
const userNotInGroup = (typeof args.options.groupId !== 'undefined') ?
|
|
42
42
|
'The specified user does not belong to the given Microsoft 365 Group. Please use the \'o365group user add\' command to add new users.' :
|
|
43
43
|
'The specified user does not belong to the given Microsoft Teams team. Please use the \'graph teams user add\' command to add new users.';
|
|
44
44
|
throw new Error(userNotInGroup);
|
|
45
45
|
}
|
|
46
46
|
if (args.options.role === "Owner") {
|
|
47
|
-
const foundMember = this.items.find(e =>
|
|
47
|
+
const foundMember = this.items.find(e => args.options.userName.toUpperCase() === e.userPrincipalName.toUpperCase() && e.userType === 'Member');
|
|
48
48
|
if (foundMember !== undefined) {
|
|
49
49
|
const endpoint = `${this.resource}/v1.0/groups/${groupId}/owners/$ref`;
|
|
50
50
|
const requestOptions = {
|
|
@@ -65,7 +65,7 @@ class AadO365GroupUserSetCommand extends GraphItemsListCommand_1.GraphItemsListC
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
|
-
const foundOwner = this.items.find(e =>
|
|
68
|
+
const foundOwner = this.items.find(e => args.options.userName.toUpperCase() === e.userPrincipalName.toUpperCase() && e.userType === 'Owner');
|
|
69
69
|
if (foundOwner !== undefined) {
|
|
70
70
|
const endpoint = `${this.resource}/v1.0/groups/${groupId}/owners/${foundOwner.id}/$ref`;
|
|
71
71
|
const requestOptions = {
|
|
@@ -20,10 +20,20 @@ class AadUserGetCommand extends GraphCommand_1.default {
|
|
|
20
20
|
}
|
|
21
21
|
commandAction(logger, args, cb) {
|
|
22
22
|
const properties = args.options.properties ?
|
|
23
|
-
|
|
23
|
+
`&$select=${args.options.properties.split(',').map(p => encodeURIComponent(p.trim())).join(',')}` :
|
|
24
24
|
'';
|
|
25
|
+
let requestUrl = `${this.resource}/v1.0/users`;
|
|
26
|
+
if (args.options.id) {
|
|
27
|
+
requestUrl += `?$filter=id eq '${encodeURIComponent(args.options.id)}'${properties}`;
|
|
28
|
+
}
|
|
29
|
+
else if (args.options.userName) {
|
|
30
|
+
requestUrl += `?$filter=userPrincipalName eq '${encodeURIComponent(args.options.userName)}'${properties}`;
|
|
31
|
+
}
|
|
32
|
+
else if (args.options.email) {
|
|
33
|
+
requestUrl += `?$filter=mail eq '${encodeURIComponent(args.options.email)}'${properties}`;
|
|
34
|
+
}
|
|
25
35
|
const requestOptions = {
|
|
26
|
-
url:
|
|
36
|
+
url: requestUrl,
|
|
27
37
|
headers: {
|
|
28
38
|
accept: 'application/json;odata.metadata=none'
|
|
29
39
|
},
|
|
@@ -31,6 +41,18 @@ class AadUserGetCommand extends GraphCommand_1.default {
|
|
|
31
41
|
};
|
|
32
42
|
request_1.default
|
|
33
43
|
.get(requestOptions)
|
|
44
|
+
.then((res) => {
|
|
45
|
+
if (res.value.length === 1) {
|
|
46
|
+
return Promise.resolve(res.value[0]);
|
|
47
|
+
}
|
|
48
|
+
const identifier = args.options.id ? `id ${args.options.id}`
|
|
49
|
+
: args.options.userName ? `user name ${args.options.userName}`
|
|
50
|
+
: `email ${args.options.email}`;
|
|
51
|
+
if (res.value.length === 0) {
|
|
52
|
+
return Promise.reject(`The specified user with ${identifier} does not exist`);
|
|
53
|
+
}
|
|
54
|
+
return Promise.reject(`Multiple users with ${identifier} found. Please disambiguate (user names): ${res.value.map(a => a.userPrincipalName).join(', ')} or (ids): ${res.value.map(a => a.id).join(', ')}`);
|
|
55
|
+
})
|
|
34
56
|
.then((res) => {
|
|
35
57
|
logger.log(res);
|
|
36
58
|
cb();
|
|
@@ -44,6 +66,9 @@ class AadUserGetCommand extends GraphCommand_1.default {
|
|
|
44
66
|
{
|
|
45
67
|
option: '-n, --userName [userName]'
|
|
46
68
|
},
|
|
69
|
+
{
|
|
70
|
+
option: '--email [email]'
|
|
71
|
+
},
|
|
47
72
|
{
|
|
48
73
|
option: '-p, --properties [properties]'
|
|
49
74
|
}
|
|
@@ -52,11 +77,13 @@ class AadUserGetCommand extends GraphCommand_1.default {
|
|
|
52
77
|
return options.concat(parentOptions);
|
|
53
78
|
}
|
|
54
79
|
validate(args) {
|
|
55
|
-
if (!args.options.id && !args.options.userName) {
|
|
56
|
-
return 'Specify
|
|
80
|
+
if (!args.options.id && !args.options.userName && !args.options.email) {
|
|
81
|
+
return 'Specify id, userName or email, one is required';
|
|
57
82
|
}
|
|
58
|
-
if (args.options.id && args.options.
|
|
59
|
-
|
|
83
|
+
if ((args.options.id && args.options.email) ||
|
|
84
|
+
(args.options.id && args.options.userName) ||
|
|
85
|
+
(args.options.userName && args.options.email)) {
|
|
86
|
+
return 'Use either id, userName or email, but not all';
|
|
60
87
|
}
|
|
61
88
|
if (args.options.id &&
|
|
62
89
|
!Utils_1.default.isValidGuid(args.options.id)) {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const Utils_1 = require("../../../../Utils");
|
|
5
|
+
const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class AadUserHibpCommand extends AnonymousCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.USER_HIBP;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Allows you to retrieve all accounts that have been pwned with the specified username';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.domain = args.options.domain;
|
|
17
|
+
return telemetryProps;
|
|
18
|
+
}
|
|
19
|
+
commandAction(logger, args, cb) {
|
|
20
|
+
const requestOptions = {
|
|
21
|
+
url: `https://haveibeenpwned.com/api/v3/breachedaccount/${encodeURIComponent(args.options.userName)}${(args.options.domain ? `?domain=${encodeURIComponent(args.options.domain)}` : '')}`,
|
|
22
|
+
headers: {
|
|
23
|
+
'accept': 'application/json',
|
|
24
|
+
'hibp-api-key': args.options.apiKey,
|
|
25
|
+
'x-anonymous': true
|
|
26
|
+
},
|
|
27
|
+
responseType: 'json'
|
|
28
|
+
};
|
|
29
|
+
request_1.default
|
|
30
|
+
.get(requestOptions)
|
|
31
|
+
.then((res) => {
|
|
32
|
+
logger.log(res);
|
|
33
|
+
cb();
|
|
34
|
+
})
|
|
35
|
+
.catch((err) => {
|
|
36
|
+
if ((err && err.response !== undefined && err.response.status === 404) && (this.debug || this.verbose)) {
|
|
37
|
+
logger.log('No pwnage found');
|
|
38
|
+
cb();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return this.handleRejectedODataJsonPromise(err, logger, cb);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
options() {
|
|
45
|
+
const options = [
|
|
46
|
+
{
|
|
47
|
+
option: '-n, --userName <userName>'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
option: '--apiKey, <apiKey>'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
option: '--domain, [domain]'
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
const parentOptions = super.options();
|
|
57
|
+
return options.concat(parentOptions);
|
|
58
|
+
}
|
|
59
|
+
validate(args) {
|
|
60
|
+
if (!Utils_1.default.isValidUserPrincipalName(args.options.userName)) {
|
|
61
|
+
return 'Specify valid userName';
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
module.exports = new AadUserHibpCommand();
|
|
67
|
+
//# sourceMappingURL=user-hibp.js.map
|
|
@@ -15,6 +15,7 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
15
15
|
getTelemetryProperties(args) {
|
|
16
16
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
17
|
telemetryProps.properties = args.options.properties;
|
|
18
|
+
telemetryProps.deleted = typeof args.options.deleted !== 'undefined';
|
|
18
19
|
return telemetryProps;
|
|
19
20
|
}
|
|
20
21
|
commandAction(logger, args, cb) {
|
|
@@ -22,7 +23,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
22
23
|
args.options.properties.split(',').map(p => p.trim()) :
|
|
23
24
|
['userPrincipalName', 'displayName'];
|
|
24
25
|
const filter = this.getFilter(args.options);
|
|
25
|
-
const
|
|
26
|
+
const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.user' : 'users';
|
|
27
|
+
const url = `${this.resource}/v1.0/${endpoint}?$select=${properties.join(',')}${(filter.length > 0 ? '&' + filter : '')}&$top=100`;
|
|
26
28
|
this
|
|
27
29
|
.getAllItems(url, logger, true)
|
|
28
30
|
.then(() => {
|
|
@@ -35,6 +37,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
35
37
|
const excludeOptions = [
|
|
36
38
|
'properties',
|
|
37
39
|
'p',
|
|
40
|
+
'deleted',
|
|
41
|
+
'd',
|
|
38
42
|
'debug',
|
|
39
43
|
'verbose',
|
|
40
44
|
'output',
|
|
@@ -55,9 +59,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
|
55
59
|
}
|
|
56
60
|
options() {
|
|
57
61
|
const options = [
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
}
|
|
62
|
+
{ option: '-p, --properties [properties]' },
|
|
63
|
+
{ option: '-d, --deleted' }
|
|
61
64
|
];
|
|
62
65
|
const parentOptions = super.options();
|
|
63
66
|
return options.concat(parentOptions);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class AadUserPasswordValidateCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.USER_PASSWORD_VALIDATE;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return "Check a user's password against the organization's password validation policy";
|
|
12
|
+
}
|
|
13
|
+
commandAction(logger, args, cb) {
|
|
14
|
+
const requestOptions = {
|
|
15
|
+
url: `${this.resource}/beta/users/validatePassword`,
|
|
16
|
+
headers: {
|
|
17
|
+
accept: 'application/json;odata.metadata=none'
|
|
18
|
+
},
|
|
19
|
+
data: {
|
|
20
|
+
password: args.options.password
|
|
21
|
+
},
|
|
22
|
+
responseType: 'json'
|
|
23
|
+
};
|
|
24
|
+
request_1.default
|
|
25
|
+
.post(requestOptions)
|
|
26
|
+
.then((res) => {
|
|
27
|
+
logger.log(res);
|
|
28
|
+
cb();
|
|
29
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
30
|
+
}
|
|
31
|
+
options() {
|
|
32
|
+
const options = [
|
|
33
|
+
{
|
|
34
|
+
option: '-p, --password <password>'
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
const parentOptions = super.options();
|
|
38
|
+
return options.concat(parentOptions);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
module.exports = new AadUserPasswordValidateCommand();
|
|
42
|
+
//# sourceMappingURL=user-password-validate.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const prefix = 'aad';
|
|
4
4
|
exports.default = {
|
|
5
5
|
APP_ADD: `${prefix} app add`,
|
|
6
|
+
APP_DELETE: `${prefix} app delete`,
|
|
6
7
|
APP_GET: `${prefix} app get`,
|
|
7
8
|
APP_SET: `${prefix} app set`,
|
|
8
9
|
APP_ROLE_ADD: `${prefix} app role add`,
|
|
@@ -11,6 +12,7 @@ exports.default = {
|
|
|
11
12
|
APPROLEASSIGNMENT_ADD: `${prefix} approleassignment add`,
|
|
12
13
|
APPROLEASSIGNMENT_LIST: `${prefix} approleassignment list`,
|
|
13
14
|
APPROLEASSIGNMENT_REMOVE: `${prefix} approleassignment remove`,
|
|
15
|
+
GROUP_LIST: `${prefix} group list`,
|
|
14
16
|
GROUPSETTING_ADD: `${prefix} groupsetting add`,
|
|
15
17
|
GROUPSETTING_GET: `${prefix} groupsetting get`,
|
|
16
18
|
GROUPSETTING_LIST: `${prefix} groupsetting list`,
|
|
@@ -21,6 +23,7 @@ exports.default = {
|
|
|
21
23
|
O365GROUP_ADD: `${prefix} o365group add`,
|
|
22
24
|
O365GROUP_GET: `${prefix} o365group get`,
|
|
23
25
|
O365GROUP_LIST: `${prefix} o365group list`,
|
|
26
|
+
O365GROUP_CONVERSATION_LIST: `${prefix} o365group conversation list`,
|
|
24
27
|
O365GROUP_RECYCLEBINITEM_CLEAR: `${prefix} o365group recyclebinitem clear`,
|
|
25
28
|
O365GROUP_RECYCLEBINITEM_LIST: `${prefix} o365group recyclebinitem list`,
|
|
26
29
|
O365GROUP_RECYCLEBINITEM_RESTORE: `${prefix} o365group recyclebinitem restore`,
|
|
@@ -50,7 +53,9 @@ exports.default = {
|
|
|
50
53
|
SP_ADD: `${prefix} sp add`,
|
|
51
54
|
SP_GET: `${prefix} sp get`,
|
|
52
55
|
USER_GET: `${prefix} user get`,
|
|
56
|
+
USER_HIBP: `${prefix} user hibp`,
|
|
53
57
|
USER_LIST: `${prefix} user list`,
|
|
58
|
+
USER_PASSWORD_VALIDATE: `${prefix} user password validate`,
|
|
54
59
|
USER_SET: `${prefix} user set`
|
|
55
60
|
};
|
|
56
61
|
//# sourceMappingURL=commands.js.map
|