@pnp/cli-microsoft365 4.3.0 → 4.4.0-beta.18b02d9
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/dist/Utils.js +4 -0
- package/dist/cli/Cli.js +7 -9
- package/dist/m365/aad/commands/group/group-list.js +41 -0
- package/dist/m365/aad/commands/user/user-hibp.js +67 -0
- package/dist/m365/aad/commands.js +2 -0
- package/dist/m365/cli/commands/config/config-set.js +4 -1
- package/dist/m365/pa/cds-project-mutator.js +1 -1
- package/dist/m365/spo/commands/group/group-user-add.js +64 -13
- package/dist/m365/teams/commands/app/app-list.js +9 -6
- 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/tab/tab-get.js +9 -6
- package/dist/m365/teams/commands.js +3 -0
- package/dist/settingsNames.js +6 -1
- package/docs/docs/cmd/aad/group/group-list.md +21 -0
- package/docs/docs/cmd/aad/user/user-hibp.md +46 -0
- package/docs/docs/cmd/spo/group/group-user-add.md +24 -6
- 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/npm-shrinkwrap.json +268 -369
- package/package.json +20 -19
package/dist/Utils.js
CHANGED
|
@@ -51,6 +51,10 @@ class Utils {
|
|
|
51
51
|
const guidRegEx = new RegExp(/^19:[0-9a-zA-Z-_]+@thread\.(skype|tacv2)$/i);
|
|
52
52
|
return guidRegEx.test(guid);
|
|
53
53
|
}
|
|
54
|
+
static isValidTeamsChatId(guid) {
|
|
55
|
+
const guidRegEx = new RegExp(/^19:[0-9a-zA-Z-_]+(@thread\.v2|@unq\.gbl\.spaces)$/i);
|
|
56
|
+
return guidRegEx.test(guid);
|
|
57
|
+
}
|
|
54
58
|
static isValidUserPrincipalName(upn) {
|
|
55
59
|
const upnRegEx = new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/i);
|
|
56
60
|
return upnRegEx.test(upn);
|
package/dist/cli/Cli.js
CHANGED
|
@@ -447,16 +447,14 @@ class Cli {
|
|
|
447
447
|
}
|
|
448
448
|
if (options.output === 'csv') {
|
|
449
449
|
const { stringify } = require('csv-stringify/sync');
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
*/
|
|
450
|
+
const cli = Cli.getInstance();
|
|
451
|
+
// https://csv.js.org/stringify/options/
|
|
458
452
|
return stringify(logStatement, {
|
|
459
|
-
header: true
|
|
453
|
+
header: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvHeader, true),
|
|
454
|
+
escape: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvEscape, '"'),
|
|
455
|
+
quote: cli.config.get(settingsNames_1.settingsNames.csvQuote),
|
|
456
|
+
quoted: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvQuoted, false),
|
|
457
|
+
quotedEmpty: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvQuotedEmpty, false)
|
|
460
458
|
});
|
|
461
459
|
}
|
|
462
460
|
// display object as a list of key-value pairs
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
defaultProperties() {
|
|
13
|
+
return ['id', 'displayName', 'groupType'];
|
|
14
|
+
}
|
|
15
|
+
commandAction(logger, args, cb) {
|
|
16
|
+
this
|
|
17
|
+
.getAllItems(`${this.resource}/v1.0/groups`, logger, true)
|
|
18
|
+
.then(() => {
|
|
19
|
+
if (args.options.output === 'text') {
|
|
20
|
+
this.items.forEach((group) => {
|
|
21
|
+
if (group.groupTypes && group.groupTypes.length > 0 && group.groupTypes[0] === 'Unified') {
|
|
22
|
+
group.groupType = 'Microsoft 365';
|
|
23
|
+
}
|
|
24
|
+
else if (group.mailEnabled && group.securityEnabled) {
|
|
25
|
+
group.groupType = 'Mail enabled security';
|
|
26
|
+
}
|
|
27
|
+
else if (group.securityEnabled) {
|
|
28
|
+
group.groupType = 'Security';
|
|
29
|
+
}
|
|
30
|
+
else if (group.mailEnabled) {
|
|
31
|
+
group.groupType = 'Distribution';
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
logger.log(this.items);
|
|
36
|
+
cb();
|
|
37
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
module.exports = new AadGroupListCommand();
|
|
41
|
+
//# sourceMappingURL=group-list.js.map
|
|
@@ -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
|
|
@@ -11,6 +11,7 @@ exports.default = {
|
|
|
11
11
|
APPROLEASSIGNMENT_ADD: `${prefix} approleassignment add`,
|
|
12
12
|
APPROLEASSIGNMENT_LIST: `${prefix} approleassignment list`,
|
|
13
13
|
APPROLEASSIGNMENT_REMOVE: `${prefix} approleassignment remove`,
|
|
14
|
+
GROUP_LIST: `${prefix} group list`,
|
|
14
15
|
GROUPSETTING_ADD: `${prefix} groupsetting add`,
|
|
15
16
|
GROUPSETTING_GET: `${prefix} groupsetting get`,
|
|
16
17
|
GROUPSETTING_LIST: `${prefix} groupsetting list`,
|
|
@@ -50,6 +51,7 @@ exports.default = {
|
|
|
50
51
|
SP_ADD: `${prefix} sp add`,
|
|
51
52
|
SP_GET: `${prefix} sp get`,
|
|
52
53
|
USER_GET: `${prefix} user get`,
|
|
54
|
+
USER_HIBP: `${prefix} user hibp`,
|
|
53
55
|
USER_LIST: `${prefix} user list`,
|
|
54
56
|
USER_PASSWORD_VALIDATE: `${prefix} user password validate`,
|
|
55
57
|
USER_SET: `${prefix} user set`
|
|
@@ -21,6 +21,9 @@ class CliConfigSetCommand extends AnonymousCommand_1.default {
|
|
|
21
21
|
switch (args.options.key) {
|
|
22
22
|
case settingsNames_1.settingsNames.showHelpOnFailure:
|
|
23
23
|
case settingsNames_1.settingsNames.printErrorsAsPlainText:
|
|
24
|
+
case settingsNames_1.settingsNames.csvHeader:
|
|
25
|
+
case settingsNames_1.settingsNames.csvQuoted:
|
|
26
|
+
case settingsNames_1.settingsNames.csvQuotedEmpty:
|
|
24
27
|
value = args.options.value === 'true';
|
|
25
28
|
break;
|
|
26
29
|
default:
|
|
@@ -47,7 +50,7 @@ class CliConfigSetCommand extends AnonymousCommand_1.default {
|
|
|
47
50
|
if (CliConfigSetCommand.optionNames.indexOf(args.options.key) < 0) {
|
|
48
51
|
return `${args.options.key} is not a valid setting. Allowed values: ${CliConfigSetCommand.optionNames.join(', ')}`;
|
|
49
52
|
}
|
|
50
|
-
const allowedOutputs = ['text', 'json'];
|
|
53
|
+
const allowedOutputs = ['text', 'json', 'csv'];
|
|
51
54
|
if (args.options.key === settingsNames_1.settingsNames.output &&
|
|
52
55
|
allowedOutputs.indexOf(args.options.value) === -1) {
|
|
53
56
|
return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${allowedOutputs.join(', ')}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const path = require("path");
|
|
4
|
-
const xmldom_1 = require("xmldom");
|
|
4
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
5
5
|
/*
|
|
6
6
|
* Logic extracted from bolt.module.solution.dll
|
|
7
7
|
* Version: 0.4.3
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const cli_1 = require("../../../../cli");
|
|
4
4
|
const Command_1 = require("../../../../Command");
|
|
5
5
|
const request_1 = require("../../../../request");
|
|
6
|
-
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
7
6
|
const AadUserGetCommand = require("../../../aad/commands/user/user-get");
|
|
7
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
8
8
|
const commands_1 = require("../../commands");
|
|
9
9
|
class SpoGroupUserAddCommand extends SpoCommand_1.default {
|
|
10
10
|
get name() {
|
|
@@ -17,15 +17,21 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
|
|
|
17
17
|
return ['DisplayName', 'Email'];
|
|
18
18
|
}
|
|
19
19
|
commandAction(logger, args, cb) {
|
|
20
|
-
|
|
20
|
+
let groupId = 0;
|
|
21
|
+
this
|
|
22
|
+
.getGroupId(args)
|
|
23
|
+
.then((_groupId) => {
|
|
24
|
+
groupId = _groupId;
|
|
25
|
+
return this.getOnlyActiveUsers(args, logger);
|
|
26
|
+
})
|
|
21
27
|
.then((resolvedUsernameList) => {
|
|
22
28
|
if (this.verbose) {
|
|
23
|
-
logger.logToStderr(`Start adding Active user/s to SharePoint Group ${args.options.groupId}
|
|
29
|
+
logger.logToStderr(`Start adding Active user/s to SharePoint Group ${args.options.groupId ? args.options.groupId : args.options.groupName}`);
|
|
24
30
|
}
|
|
25
31
|
const data = {
|
|
26
32
|
url: args.options.webUrl,
|
|
27
33
|
peoplePickerInput: this.getFormattedUserList(resolvedUsernameList),
|
|
28
|
-
roleValue: `group:${
|
|
34
|
+
roleValue: `group:${groupId}`
|
|
29
35
|
};
|
|
30
36
|
const requestOptions = {
|
|
31
37
|
url: `${args.options.webUrl}/_api/SP.Web.ShareObject`,
|
|
@@ -46,24 +52,51 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
|
|
|
46
52
|
cb();
|
|
47
53
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
48
54
|
}
|
|
55
|
+
getGroupId(args) {
|
|
56
|
+
if (args.options.groupId) {
|
|
57
|
+
return Promise.resolve(args.options.groupId);
|
|
58
|
+
}
|
|
59
|
+
const requestOptions = {
|
|
60
|
+
url: `${args.options.webUrl}/_api/web/sitegroups/GetByName('${encodeURIComponent(args.options.groupName)}')`,
|
|
61
|
+
headers: {
|
|
62
|
+
'accept': 'application/json;odata=nometadata'
|
|
63
|
+
},
|
|
64
|
+
responseType: 'json'
|
|
65
|
+
};
|
|
66
|
+
return request_1.default
|
|
67
|
+
.get(requestOptions)
|
|
68
|
+
.then(response => {
|
|
69
|
+
const groupId = response.Id;
|
|
70
|
+
if (!groupId) {
|
|
71
|
+
return Promise.reject(`The specified group not exist in the SharePoint site`);
|
|
72
|
+
}
|
|
73
|
+
return Promise.resolve(groupId);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
49
76
|
getOnlyActiveUsers(args, logger) {
|
|
50
77
|
if (this.verbose) {
|
|
51
78
|
logger.logToStderr(`Removing Users which are not active from the original list`);
|
|
52
79
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
80
|
+
const activeUserNameList = [];
|
|
81
|
+
const userInfo = args.options.userName ? args.options.userName : args.options.email;
|
|
82
|
+
return Promise.all(userInfo.split(',').map(singleUserName => {
|
|
55
83
|
const options = {
|
|
56
|
-
userName: singleUsername.trim(),
|
|
57
84
|
output: 'json',
|
|
58
85
|
debug: args.options.debug,
|
|
59
86
|
verbose: args.options.verbose
|
|
60
87
|
};
|
|
88
|
+
if (args.options.userName) {
|
|
89
|
+
options.userName = singleUserName.trim();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
options.email = singleUserName.trim();
|
|
93
|
+
}
|
|
61
94
|
return cli_1.Cli.executeCommandWithOutput(AadUserGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) })
|
|
62
95
|
.then((getUserGetOutput) => {
|
|
63
96
|
if (this.debug) {
|
|
64
97
|
logger.logToStderr(getUserGetOutput.stderr);
|
|
65
98
|
}
|
|
66
|
-
|
|
99
|
+
activeUserNameList.push(JSON.parse(getUserGetOutput.stdout).userPrincipalName);
|
|
67
100
|
}, (err) => {
|
|
68
101
|
if (this.debug) {
|
|
69
102
|
logger.logToStderr(err.stderr);
|
|
@@ -71,7 +104,7 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
|
|
|
71
104
|
});
|
|
72
105
|
}))
|
|
73
106
|
.then(() => {
|
|
74
|
-
return Promise.resolve(
|
|
107
|
+
return Promise.resolve(activeUserNameList);
|
|
75
108
|
});
|
|
76
109
|
}
|
|
77
110
|
getFormattedUserList(activeUserList) {
|
|
@@ -86,10 +119,16 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
|
|
|
86
119
|
option: '-u, --webUrl <webUrl>'
|
|
87
120
|
},
|
|
88
121
|
{
|
|
89
|
-
option: '--groupId
|
|
122
|
+
option: '--groupId [groupId]'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
option: '--groupName [groupName]'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
option: '--userName [userName]'
|
|
90
129
|
},
|
|
91
130
|
{
|
|
92
|
-
option: '--
|
|
131
|
+
option: '--email [email]'
|
|
93
132
|
}
|
|
94
133
|
];
|
|
95
134
|
const parentOptions = super.options();
|
|
@@ -100,8 +139,20 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
|
|
|
100
139
|
if (isValidSharePointUrl !== true) {
|
|
101
140
|
return isValidSharePointUrl;
|
|
102
141
|
}
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
142
|
+
if (!args.options.groupId && !args.options.groupName) {
|
|
143
|
+
return 'Specify either groupId or groupName';
|
|
144
|
+
}
|
|
145
|
+
if (args.options.groupId && args.options.groupName) {
|
|
146
|
+
return 'Specify either groupId or groupName but not both';
|
|
147
|
+
}
|
|
148
|
+
if (!args.options.userName && !args.options.email) {
|
|
149
|
+
return 'Specify either userName or email';
|
|
150
|
+
}
|
|
151
|
+
if (args.options.userName && args.options.email) {
|
|
152
|
+
return 'Specify either userName or email but not both';
|
|
153
|
+
}
|
|
154
|
+
if (args.options.groupId && isNaN(args.options.groupId)) {
|
|
155
|
+
return `Specified groupId ${args.options.groupId} is not a number`;
|
|
105
156
|
}
|
|
106
157
|
return true;
|
|
107
158
|
}
|
|
@@ -25,24 +25,27 @@ class TeamsAppListCommand extends GraphItemsListCommand_1.GraphItemsListCommand
|
|
|
25
25
|
if (args.options.teamId) {
|
|
26
26
|
return Promise.resolve(args.options.teamId);
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
url: `${this.resource}/v1.0/
|
|
28
|
+
const requestOptions = {
|
|
29
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
|
|
30
30
|
headers: {
|
|
31
31
|
accept: 'application/json;odata.metadata=none'
|
|
32
32
|
},
|
|
33
33
|
responseType: 'json'
|
|
34
34
|
};
|
|
35
35
|
return request_1.default
|
|
36
|
-
.get(
|
|
36
|
+
.get(requestOptions)
|
|
37
37
|
.then(response => {
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
38
|
+
const groupItem = response.value[0];
|
|
39
|
+
if (!groupItem) {
|
|
40
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
41
|
+
}
|
|
42
|
+
if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
|
|
40
43
|
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
41
44
|
}
|
|
42
45
|
if (response.value.length > 1) {
|
|
43
46
|
return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
|
|
44
47
|
}
|
|
45
|
-
return Promise.resolve(
|
|
48
|
+
return Promise.resolve(groupItem.id);
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
getEndpointUrl(args) {
|
|
@@ -0,0 +1,43 @@
|
|
|
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 TeamsChatListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
6
|
+
get name() {
|
|
7
|
+
return commands_1.default.CHAT_LIST;
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'Lists all chat conversations';
|
|
11
|
+
}
|
|
12
|
+
defaultProperties() {
|
|
13
|
+
return ['id', 'topic', 'chatType'];
|
|
14
|
+
}
|
|
15
|
+
commandAction(logger, args, cb) {
|
|
16
|
+
const filter = args.options.type !== undefined ? `?$filter=chatType eq '${args.options.type}'` : '';
|
|
17
|
+
const endpoint = `${this.resource}/v1.0/chats${filter}`;
|
|
18
|
+
this
|
|
19
|
+
.getAllItems(endpoint, logger, true)
|
|
20
|
+
.then(() => {
|
|
21
|
+
logger.log(this.items);
|
|
22
|
+
cb();
|
|
23
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
24
|
+
}
|
|
25
|
+
options() {
|
|
26
|
+
const options = [
|
|
27
|
+
{
|
|
28
|
+
option: '-t, --type [chatType]'
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
const parentOptions = super.options();
|
|
32
|
+
return options.concat(parentOptions);
|
|
33
|
+
}
|
|
34
|
+
validate(args) {
|
|
35
|
+
const supportedTypes = ['oneOnOne', 'group', 'meeting'];
|
|
36
|
+
if (args.options.type !== undefined && supportedTypes.indexOf(args.options.type) === -1) {
|
|
37
|
+
return `${args.options.type} is not a valid chatType. Accepted values are ${supportedTypes.join(', ')}`;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
module.exports = new TeamsChatListCommand();
|
|
43
|
+
//# sourceMappingURL=chat-list.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
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 TeamsChatMemberListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.CHAT_MEMBER_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists all members from a chat';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['userId', 'displayName', 'email'];
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/members`;
|
|
18
|
+
this
|
|
19
|
+
.getAllItems(endpoint, logger, true)
|
|
20
|
+
.then(() => {
|
|
21
|
+
logger.log(this.items);
|
|
22
|
+
cb();
|
|
23
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
24
|
+
}
|
|
25
|
+
options() {
|
|
26
|
+
const options = [
|
|
27
|
+
{
|
|
28
|
+
option: '-i, --chatId <chatId>'
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
const parentOptions = super.options();
|
|
32
|
+
return options.concat(parentOptions);
|
|
33
|
+
}
|
|
34
|
+
validate(args) {
|
|
35
|
+
if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
|
|
36
|
+
return `${args.options.chatId} is not a valid Teams ChatId`;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
module.exports = new TeamsChatMemberListCommand();
|
|
42
|
+
//# sourceMappingURL=chat-member-list.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
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 TeamsChatMessageListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.CHAT_MESSAGE_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists all messages from a chat';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['id', 'shortBody'];
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
|
|
18
|
+
this
|
|
19
|
+
.getAllItems(endpoint, logger, true)
|
|
20
|
+
.then(() => {
|
|
21
|
+
if (args.options.output !== 'json') {
|
|
22
|
+
this.items.forEach(i => {
|
|
23
|
+
// hoist the content to body for readability
|
|
24
|
+
i.body = i.body.content;
|
|
25
|
+
let shortBody;
|
|
26
|
+
const bodyToProcess = i.body;
|
|
27
|
+
if (bodyToProcess) {
|
|
28
|
+
let maxLength = 50;
|
|
29
|
+
let addedDots = '...';
|
|
30
|
+
if (bodyToProcess.length < maxLength) {
|
|
31
|
+
maxLength = bodyToProcess.length;
|
|
32
|
+
addedDots = '';
|
|
33
|
+
}
|
|
34
|
+
shortBody = bodyToProcess.replace(/\n/g, ' ').substring(0, maxLength) + addedDots;
|
|
35
|
+
}
|
|
36
|
+
i.shortBody = shortBody;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
logger.log(this.items);
|
|
40
|
+
cb();
|
|
41
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
42
|
+
}
|
|
43
|
+
options() {
|
|
44
|
+
const options = [
|
|
45
|
+
{
|
|
46
|
+
option: '-i, --chatId <chatId>'
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
const parentOptions = super.options();
|
|
50
|
+
return options.concat(parentOptions);
|
|
51
|
+
}
|
|
52
|
+
validate(args) {
|
|
53
|
+
if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
|
|
54
|
+
return `${args.options.chatId} is not a valid Teams chat ID`;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
module.exports = new TeamsChatMessageListCommand();
|
|
60
|
+
//# sourceMappingURL=chat-message-list.js.map
|
|
@@ -30,24 +30,27 @@ class TeamsTabGetCommand extends GraphCommand_1.default {
|
|
|
30
30
|
if (args.options.teamId) {
|
|
31
31
|
return Promise.resolve(args.options.teamId);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
url: `${this.resource}/v1.0/
|
|
33
|
+
const requestOptions = {
|
|
34
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
|
|
35
35
|
headers: {
|
|
36
36
|
accept: 'application/json;odata.metadata=none'
|
|
37
37
|
},
|
|
38
38
|
responseType: 'json'
|
|
39
39
|
};
|
|
40
40
|
return request_1.default
|
|
41
|
-
.get(
|
|
41
|
+
.get(requestOptions)
|
|
42
42
|
.then(response => {
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
43
|
+
const groupItem = response.value[0];
|
|
44
|
+
if (!groupItem) {
|
|
45
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
46
|
+
}
|
|
47
|
+
if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
|
|
45
48
|
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
46
49
|
}
|
|
47
50
|
if (response.value.length > 1) {
|
|
48
51
|
return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
|
|
49
52
|
}
|
|
50
|
-
return Promise.resolve(
|
|
53
|
+
return Promise.resolve(groupItem.id);
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
56
|
getChannelId(args) {
|
|
@@ -13,6 +13,9 @@ exports.default = {
|
|
|
13
13
|
CHANNEL_LIST: `${prefix} channel list`,
|
|
14
14
|
CHANNEL_REMOVE: `${prefix} channel remove`,
|
|
15
15
|
CHANNEL_SET: `${prefix} channel set`,
|
|
16
|
+
CHAT_LIST: `${prefix} chat list`,
|
|
17
|
+
CHAT_MEMBER_LIST: `${prefix} chat member list`,
|
|
18
|
+
CHAT_MESSAGE_LIST: `${prefix} chat message list`,
|
|
16
19
|
CONVERSATIONMEMBER_ADD: `${prefix} conversationmember add`,
|
|
17
20
|
CONVERSATIONMEMBER_LIST: `${prefix} conversationmember list`,
|
|
18
21
|
FUNSETTINGS_LIST: `${prefix} funsettings list`,
|
package/dist/settingsNames.js
CHANGED
|
@@ -5,7 +5,12 @@ const settingsNames = {
|
|
|
5
5
|
errorOutput: 'errorOutput',
|
|
6
6
|
output: 'output',
|
|
7
7
|
printErrorsAsPlainText: 'printErrorsAsPlainText',
|
|
8
|
-
showHelpOnFailure: 'showHelpOnFailure'
|
|
8
|
+
showHelpOnFailure: 'showHelpOnFailure',
|
|
9
|
+
csvHeader: 'csvHeader',
|
|
10
|
+
csvEscape: 'csvEscape',
|
|
11
|
+
csvQuote: 'csvQuote',
|
|
12
|
+
csvQuoted: 'csvQuoted',
|
|
13
|
+
csvQuotedEmpty: 'csvQuotedEmpty'
|
|
9
14
|
};
|
|
10
15
|
exports.settingsNames = settingsNames;
|
|
11
16
|
//# sourceMappingURL=settingsNames.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# aad group list
|
|
2
|
+
|
|
3
|
+
Lists Azure AD groups
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 aad group list [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
--8<-- "docs/cmd/_global.md"
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
Lists all groups defined in Azure Active Directory.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
m365 aad group list
|
|
21
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# aad user hibp
|
|
2
|
+
|
|
3
|
+
Allows you to retrieve all accounts that have been pwned with the specified username
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 aad user hibp [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-n, --userName <userName>`
|
|
14
|
+
: The name of the user to retrieve information for.
|
|
15
|
+
|
|
16
|
+
`--apiKey, <apiKey>`
|
|
17
|
+
: Have I been pwned `API Key`. You can buy it from [https://haveibeenpwned.com/API/Key](https://haveibeenpwned.com/API/Key)
|
|
18
|
+
|
|
19
|
+
`--domain, [domain]`
|
|
20
|
+
: Limit the returned breaches only contain results with the domain specified.
|
|
21
|
+
|
|
22
|
+
--8<-- "docs/cmd/_global.md"
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
If the user with the specified user name doesn't involved in any breach, you will get a `No pwnage found` message when running in debug or verbose mode.
|
|
27
|
+
|
|
28
|
+
If `API Key` is invalid, you will get a `Required option apiKey not specified` error.
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
Check if user with user name _account-exists@hibp-integration-tests.com_ is in a data breach
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
m365 aad user hibp --userName account-exists@hibp-integration-tests.com --apiKey _YOUR-API-KEY_
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Check if user with user name _account-exists@hibp-integration-tests.com_ is in a data breach against the domain specified
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
m365 aad user hibp --userName account-exists@hibp-integration-tests.com --apiKey _YOUR-API-KEY_ --domain adobe.com
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## More information
|
|
45
|
+
|
|
46
|
+
- Have I been pwned API documentation: [https://haveibeenpwned.com/API/v3](https://haveibeenpwned.com/API/v3)
|