@pnp/cli-microsoft365 4.3.0-beta.fd397f5 → 5.0.0-beta.40b91b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Utils.js +3 -0
- package/dist/appInsights.js +2 -1
- package/dist/cli/Cli.js +22 -3
- package/dist/m365/aad/commands/o365group/{Group.js → GroupExtended.js} +1 -1
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +3 -3
- package/dist/m365/aad/commands/oauth2grant/oauth2grant-list.js +7 -7
- package/dist/m365/aad/commands/oauth2grant/oauth2grant-remove.js +36 -12
- package/dist/m365/aad/commands/sp/sp-get.js +44 -21
- package/dist/m365/aad/commands/user/user-get.js +33 -6
- package/dist/m365/aad/commands/user/user-password-validate.js +42 -0
- package/dist/m365/aad/commands.js +1 -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/pa/commands/app/app-list.js +28 -1
- package/dist/m365/planner/commands/task/task-add.js +288 -0
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/spo/commands/site/site-ensure.js +1 -1
- package/dist/m365/teams/commands/message/message-get.js +1 -1
- package/dist/request.js +9 -4
- package/docs/docs/cmd/_global.md +2 -2
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.md +4 -3
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.md +9 -0
- package/docs/docs/cmd/aad/sp/sp-get.md +2 -1
- package/docs/docs/cmd/aad/user/user-get.md +13 -4
- 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/pa/app/app-list.md +17 -1
- package/docs/docs/cmd/planner/task/task-add.md +78 -0
- 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/spfx-doctor.md +1 -1
- package/docs/docs/cmd/teams/message/message-get.md +0 -3
- package/npm-shrinkwrap.json +603 -743
- package/package.json +19 -15
- package/dist/m365/aad/commands/o365group/GroupUser.js +0 -3
package/README.md
CHANGED
|
@@ -179,7 +179,7 @@ m365 spo site get --url https://contoso.sharepoint.com --output text
|
|
|
179
179
|
|
|
180
180
|
## Build
|
|
181
181
|
|
|
182
|
-
To build and run this CLI locally, you will need [`node`](https://nodejs.org) `>=
|
|
182
|
+
To build and run this CLI locally, you will need [`node`](https://nodejs.org) `>= 16.0.0` installed.
|
|
183
183
|
|
|
184
184
|
```sh
|
|
185
185
|
# Clone this repository
|
package/dist/Utils.js
CHANGED
|
@@ -40,6 +40,9 @@ class Utils {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
static isValidGuidArray(guids) {
|
|
44
|
+
return guids.every(guid => this.isValidGuid(guid));
|
|
45
|
+
}
|
|
43
46
|
static isValidGuid(guid) {
|
|
44
47
|
const guidRegEx = new RegExp(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
|
|
45
48
|
return guidRegEx.test(guid);
|
package/dist/appInsights.js
CHANGED
|
@@ -20,7 +20,8 @@ const env = process.env.CLIMICROSOFT365_ENV !== undefined ? process.env.CLIMICRO
|
|
|
20
20
|
appInsights.defaultClient.commonProperties = {
|
|
21
21
|
version: version,
|
|
22
22
|
node: process.version,
|
|
23
|
-
env: env
|
|
23
|
+
env: env,
|
|
24
|
+
ci: Boolean(process.env.CI).toString()
|
|
24
25
|
};
|
|
25
26
|
appInsights.defaultClient.context.tags['ai.session.id'] = crypto.randomBytes(24).toString('base64');
|
|
26
27
|
appInsights.defaultClient.context.tags['ai.cloud.roleInstance'] = crypto.createHash('sha256').update(appInsights.defaultClient.context.tags['ai.cloud.roleInstance']).digest('hex');
|
package/dist/cli/Cli.js
CHANGED
|
@@ -17,6 +17,7 @@ const path = require("path");
|
|
|
17
17
|
const appInsights_1 = require("../appInsights");
|
|
18
18
|
const Command_1 = require("../Command");
|
|
19
19
|
const config_1 = require("../config");
|
|
20
|
+
const request_1 = require("../request");
|
|
20
21
|
const settingsNames_1 = require("../settingsNames");
|
|
21
22
|
const Utils_1 = require("../Utils");
|
|
22
23
|
const packageJSON = require('../../package.json');
|
|
@@ -204,16 +205,20 @@ class Cli {
|
|
|
204
205
|
}
|
|
205
206
|
};
|
|
206
207
|
if (args.options.debug) {
|
|
207
|
-
|
|
208
|
+
logErr.push(`Executing command ${command.name} with options ${JSON.stringify(args)}`);
|
|
208
209
|
}
|
|
209
210
|
// store the current command name, if any and set the name to the name of
|
|
210
211
|
// the command to execute
|
|
211
212
|
const cli = Cli.getInstance();
|
|
212
213
|
const parentCommandName = cli.currentCommandName;
|
|
213
214
|
cli.currentCommandName = command.getCommandName();
|
|
215
|
+
// store the current logger if any
|
|
216
|
+
const currentLogger = request_1.default.logger;
|
|
214
217
|
command.action(logger, args, (err) => {
|
|
215
218
|
// restore the original command name
|
|
216
219
|
cli.currentCommandName = parentCommandName;
|
|
220
|
+
// restore the original logger
|
|
221
|
+
request_1.default.logger = currentLogger;
|
|
217
222
|
if (err) {
|
|
218
223
|
return reject({
|
|
219
224
|
error: err,
|
|
@@ -416,11 +421,11 @@ class Cli {
|
|
|
416
421
|
if (arrayType !== 'object') {
|
|
417
422
|
return logStatement.join(os.EOL);
|
|
418
423
|
}
|
|
419
|
-
// if output type has been set to 'text', process the retrieved
|
|
424
|
+
// if output type has been set to 'text' or 'csv', process the retrieved
|
|
420
425
|
// data so that returned objects contain only default properties specified
|
|
421
426
|
// on the current command. If there is no current command or the
|
|
422
427
|
// command doesn't specify default properties, return original data
|
|
423
|
-
if (options.output === 'text') {
|
|
428
|
+
if (options.output === 'text' || options.output === 'csv') {
|
|
424
429
|
const cli = Cli.getInstance();
|
|
425
430
|
const currentCommand = cli.commandToExecute;
|
|
426
431
|
if (arrayType === 'object' &&
|
|
@@ -440,6 +445,20 @@ class Cli {
|
|
|
440
445
|
}
|
|
441
446
|
}
|
|
442
447
|
}
|
|
448
|
+
if (options.output === 'csv') {
|
|
449
|
+
const { stringify } = require('csv-stringify/sync');
|
|
450
|
+
/*
|
|
451
|
+
https://csv.js.org/stringify/options/
|
|
452
|
+
header: Display the column names on the first line if the columns option is provided or discovered.
|
|
453
|
+
escape: Single character used for escaping; only apply to characters matching the quote and the escape options default to ".
|
|
454
|
+
quote: The quote characters surrounding a field, defaults to the " (double quotation marks), an empty quote value will preserve the original field, whether it contains quotation marks or not.
|
|
455
|
+
quoted: Boolean, default to false, quote all the non-empty fields even if not required.
|
|
456
|
+
quotedEmpty: Quote empty strings and overrides quoted_string on empty strings when defined; default is false.
|
|
457
|
+
*/
|
|
458
|
+
return stringify(logStatement, {
|
|
459
|
+
header: true
|
|
460
|
+
});
|
|
461
|
+
}
|
|
443
462
|
// display object as a list of key-value pairs
|
|
444
463
|
if (logStatement.length === 1) {
|
|
445
464
|
const obj = logStatement[0];
|
|
@@ -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 = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const request_1 = require("../../../../request");
|
|
4
4
|
const Utils_1 = require("../../../../Utils");
|
|
5
|
-
const
|
|
5
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
6
|
const commands_1 = require("../../commands");
|
|
7
|
-
class AadOAuth2GrantListCommand extends
|
|
7
|
+
class AadOAuth2GrantListCommand extends GraphCommand_1.default {
|
|
8
8
|
get name() {
|
|
9
9
|
return commands_1.default.OAUTH2GRANT_LIST;
|
|
10
10
|
}
|
|
@@ -19,9 +19,9 @@ class AadOAuth2GrantListCommand extends AadCommand_1.default {
|
|
|
19
19
|
logger.logToStderr(`Retrieving list of OAuth grants for the service principal...`);
|
|
20
20
|
}
|
|
21
21
|
const requestOptions = {
|
|
22
|
-
url: `${this.resource}/
|
|
22
|
+
url: `${this.resource}/v1.0/oauth2PermissionGrants?$filter=clientId eq '${encodeURIComponent(args.options.spObjectId)}'`,
|
|
23
23
|
headers: {
|
|
24
|
-
accept: 'application/json;odata=
|
|
24
|
+
accept: 'application/json;odata.metadata=none'
|
|
25
25
|
},
|
|
26
26
|
responseType: 'json'
|
|
27
27
|
};
|
|
@@ -37,15 +37,15 @@ class AadOAuth2GrantListCommand extends AadCommand_1.default {
|
|
|
37
37
|
options() {
|
|
38
38
|
const options = [
|
|
39
39
|
{
|
|
40
|
-
option: '-i, --
|
|
40
|
+
option: '-i, --spObjectId <spObjectId>'
|
|
41
41
|
}
|
|
42
42
|
];
|
|
43
43
|
const parentOptions = super.options();
|
|
44
44
|
return options.concat(parentOptions);
|
|
45
45
|
}
|
|
46
46
|
validate(args) {
|
|
47
|
-
if (!Utils_1.default.isValidGuid(args.options.
|
|
48
|
-
return `${args.options.
|
|
47
|
+
if (!Utils_1.default.isValidGuid(args.options.spObjectId)) {
|
|
48
|
+
return `${args.options.spObjectId} is not a valid GUID`;
|
|
49
49
|
}
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
3
4
|
const request_1 = require("../../../../request");
|
|
4
5
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
6
|
const commands_1 = require("../../commands");
|
|
@@ -11,24 +12,47 @@ class AadOAuth2GrantRemoveCommand extends GraphCommand_1.default {
|
|
|
11
12
|
return 'Remove specified service principal OAuth2 permissions';
|
|
12
13
|
}
|
|
13
14
|
commandAction(logger, args, cb) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const removeOauth2Grant = () => {
|
|
16
|
+
if (this.verbose) {
|
|
17
|
+
logger.logToStderr(`Removing OAuth2 permissions...`);
|
|
18
|
+
}
|
|
19
|
+
const requestOptions = {
|
|
20
|
+
url: `${this.resource}/v1.0/oauth2PermissionGrants/${encodeURIComponent(args.options.grantId)}`,
|
|
21
|
+
headers: {
|
|
22
|
+
'accept': 'application/json;odata.metadata=none'
|
|
23
|
+
},
|
|
24
|
+
responseType: 'json'
|
|
25
|
+
};
|
|
26
|
+
request_1.default
|
|
27
|
+
.delete(requestOptions)
|
|
28
|
+
.then(_ => cb(), (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
|
|
23
29
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
if (args.options.confirm) {
|
|
31
|
+
removeOauth2Grant();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
cli_1.Cli.prompt({
|
|
35
|
+
type: 'confirm',
|
|
36
|
+
name: 'continue',
|
|
37
|
+
default: false,
|
|
38
|
+
message: `Are you sure you want to remove the OAuth2 permissions for ${args.options.grantId}?`
|
|
39
|
+
}, (result) => {
|
|
40
|
+
if (!result.continue) {
|
|
41
|
+
cb();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
removeOauth2Grant();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
27
48
|
}
|
|
28
49
|
options() {
|
|
29
50
|
const options = [
|
|
30
51
|
{
|
|
31
52
|
option: '-i, --grantId <grantId>'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
option: '--confirm'
|
|
32
56
|
}
|
|
33
57
|
];
|
|
34
58
|
const parentOptions = super.options();
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const request_1 = require("../../../../request");
|
|
4
4
|
const Utils_1 = require("../../../../Utils");
|
|
5
|
-
const
|
|
5
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
6
|
const commands_1 = require("../../commands");
|
|
7
|
-
class AadSpGetCommand extends
|
|
7
|
+
class AadSpGetCommand extends GraphCommand_1.default {
|
|
8
8
|
get name() {
|
|
9
9
|
return commands_1.default.SP_GET;
|
|
10
10
|
}
|
|
@@ -18,35 +18,58 @@ class AadSpGetCommand extends AadCommand_1.default {
|
|
|
18
18
|
telemetryProps.objectId = (!(!args.options.objectId)).toString();
|
|
19
19
|
return telemetryProps;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
21
|
+
getSpId(args) {
|
|
22
|
+
if (args.options.objectId) {
|
|
23
|
+
return Promise.resolve(args.options.objectId);
|
|
24
24
|
}
|
|
25
25
|
let spMatchQuery = '';
|
|
26
|
-
if (args.options.
|
|
27
|
-
spMatchQuery = `appId eq '${encodeURIComponent(args.options.appId)}'`;
|
|
28
|
-
}
|
|
29
|
-
else if (args.options.objectId) {
|
|
30
|
-
spMatchQuery = `objectId eq '${encodeURIComponent(args.options.objectId)}'`;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
26
|
+
if (args.options.displayName) {
|
|
33
27
|
spMatchQuery = `displayName eq '${encodeURIComponent(args.options.displayName)}'`;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
else if (args.options.appId) {
|
|
30
|
+
spMatchQuery = `appId eq '${encodeURIComponent(args.options.appId)}'`;
|
|
31
|
+
}
|
|
32
|
+
const idRequestOptions = {
|
|
33
|
+
url: `${this.resource}/v1.0/servicePrincipals?$filter=${spMatchQuery}`,
|
|
37
34
|
headers: {
|
|
38
|
-
accept: 'application/json;odata=
|
|
35
|
+
accept: 'application/json;odata.metadata=none'
|
|
39
36
|
},
|
|
40
37
|
responseType: 'json'
|
|
41
38
|
};
|
|
42
|
-
request_1.default
|
|
43
|
-
.get(
|
|
44
|
-
.then(
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
return request_1.default
|
|
40
|
+
.get(idRequestOptions)
|
|
41
|
+
.then(response => {
|
|
42
|
+
const spItem = response.value[0];
|
|
43
|
+
if (!spItem) {
|
|
44
|
+
return Promise.reject(`The specified Azure AD app does not exist`);
|
|
45
|
+
}
|
|
46
|
+
if (response.value.length > 1) {
|
|
47
|
+
return Promise.reject(`Multiple Azure AD apps with name ${args.options.displayName} found: ${response.value.map(x => x.id)}`);
|
|
47
48
|
}
|
|
49
|
+
return Promise.resolve(spItem.id);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
commandAction(logger, args, cb) {
|
|
53
|
+
if (this.verbose) {
|
|
54
|
+
logger.logToStderr(`Retrieving service principal information...`);
|
|
55
|
+
}
|
|
56
|
+
this
|
|
57
|
+
.getSpId(args)
|
|
58
|
+
.then((id) => {
|
|
59
|
+
const requestOptions = {
|
|
60
|
+
url: `${this.resource}/v1.0/servicePrincipals/${id}`,
|
|
61
|
+
headers: {
|
|
62
|
+
accept: 'application/json;odata.metadata=none',
|
|
63
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
64
|
+
},
|
|
65
|
+
responseType: 'json'
|
|
66
|
+
};
|
|
67
|
+
return request_1.default.get(requestOptions);
|
|
68
|
+
})
|
|
69
|
+
.then((res) => {
|
|
70
|
+
logger.log(res);
|
|
48
71
|
cb();
|
|
49
|
-
}, (
|
|
72
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
50
73
|
}
|
|
51
74
|
options() {
|
|
52
75
|
const options = [
|
|
@@ -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,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
|
|
@@ -51,6 +51,7 @@ exports.default = {
|
|
|
51
51
|
SP_GET: `${prefix} sp get`,
|
|
52
52
|
USER_GET: `${prefix} user get`,
|
|
53
53
|
USER_LIST: `${prefix} user list`,
|
|
54
|
+
USER_PASSWORD_VALIDATE: `${prefix} user password validate`,
|
|
54
55
|
USER_SET: `${prefix} user set`
|
|
55
56
|
};
|
|
56
57
|
//# sourceMappingURL=commands.js.map
|