@pnp/cli-microsoft365 5.3.0-beta.d2ec1f4 → 5.3.0-beta.e5dcef6
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.js +1 -0
- package/dist/m365/aad/commands/app/app-add.js +91 -35
- package/dist/m365/aad/commands/app/app-role-list.js +1 -1
- package/dist/m365/aad/commands/app/app-set.js +91 -0
- package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +55 -22
- package/dist/m365/aad/commands/group/group-list.js +1 -1
- package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +1 -1
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +1 -1
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +3 -3
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +2 -2
- package/dist/m365/aad/commands/user/user-list.js +1 -1
- package/dist/m365/aad/commands/user/user-signin-list.js +1 -1
- package/dist/m365/aad/commands.js +1 -1
- package/dist/m365/app/commands/app-open.js +64 -0
- package/dist/m365/app/commands.js +1 -0
- package/dist/m365/file/commands/file-list.js +1 -1
- package/dist/m365/outlook/commands/message/message-list.js +1 -1
- package/dist/m365/outlook/commands/room/room-list.js +1 -1
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +1 -1
- package/dist/m365/planner/commands/bucket/bucket-add.js +8 -16
- package/dist/m365/planner/commands/bucket/bucket-get.js +186 -0
- package/dist/m365/planner/commands/bucket/bucket-list.js +10 -19
- package/dist/m365/planner/commands/bucket/bucket-remove.js +8 -20
- package/dist/m365/planner/commands/bucket/bucket-set.js +9 -21
- package/dist/m365/planner/commands/plan/plan-add.js +6 -1
- package/dist/m365/planner/commands/plan/plan-details-get.js +12 -15
- package/dist/m365/planner/commands/plan/plan-get.js +13 -18
- package/dist/m365/planner/commands/plan/plan-list.js +10 -13
- package/dist/m365/planner/commands/task/task-add.js +8 -16
- package/dist/m365/planner/commands/task/task-details-get.js +6 -0
- package/dist/m365/planner/commands/task/task-get.js +138 -7
- package/dist/m365/planner/commands/task/task-list.js +15 -24
- package/dist/m365/planner/commands/task/task-set.js +9 -18
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/pp/commands/managementapp/managementapp-list.js +1 -1
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +84 -0
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +76 -0
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +83 -0
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +79 -0
- package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +49 -0
- package/dist/m365/spo/commands.js +5 -0
- package/dist/m365/teams/commands/app/app-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-get.js +8 -8
- package/dist/m365/teams/commands/chat/chat-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
- package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
- package/dist/m365/teams/commands/message/message-list.js +1 -1
- package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
- package/dist/m365/teams/commands/tab/tab-list.js +1 -1
- package/dist/m365/teams/commands/team/team-list.js +1 -1
- package/dist/m365/teams/commands/user/user-app-list.js +1 -1
- package/dist/m365/teams/commands/user/user-list.js +2 -2
- package/dist/m365/tenant/commands/security/security-alerts-list.js +71 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
- package/dist/m365/tenant/commands.js +1 -0
- package/dist/m365/todo/commands/list/list-list.js +1 -1
- package/dist/m365/todo/commands/task/task-list.js +1 -1
- package/dist/utils/accessToken.js +18 -0
- package/dist/utils/odata.js +2 -2
- package/dist/utils/planner.js +65 -0
- package/docs/docs/cmd/aad/app/app-add.md +15 -0
- package/docs/docs/cmd/aad/app/app-set.md +17 -0
- package/docs/docs/cmd/app/app-open.md +45 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.md +57 -0
- package/docs/docs/cmd/planner/task/task-get.md +30 -3
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +55 -0
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +36 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +39 -0
- package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +24 -0
- package/docs/docs/cmd/teams/channel/channel-member-list.md +4 -4
- package/docs/docs/cmd/teams/channel/channel-member-remove.md +2 -2
- package/docs/docs/cmd/teams/channel/channel-member-set.md +2 -2
- package/docs/docs/cmd/tenant/security/security-alerts-list.md +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoListItemRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.LISTITEM_ROLEINHERITANCE_BREAK;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Break inheritance of list item';
|
|
13
|
+
}
|
|
14
|
+
optionSets() {
|
|
15
|
+
return [
|
|
16
|
+
['listId', 'listTitle']
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
commandAction(logger, args, cb) {
|
|
20
|
+
if (this.verbose) {
|
|
21
|
+
logger.logToStderr(`Breaking role inheritance of list item in site at ${args.options.webUrl}...`);
|
|
22
|
+
}
|
|
23
|
+
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
24
|
+
if (args.options.listId) {
|
|
25
|
+
requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
|
|
29
|
+
}
|
|
30
|
+
let keepExistingPermissions = true;
|
|
31
|
+
if (args.options.clearExistingPermissions) {
|
|
32
|
+
keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
33
|
+
}
|
|
34
|
+
const requestOptions = {
|
|
35
|
+
url: `${requestUrl}/items(${args.options.listItemId})/breakroleinheritance(${keepExistingPermissions})`,
|
|
36
|
+
method: 'POST',
|
|
37
|
+
headers: {
|
|
38
|
+
'accept': 'application/json;odata=nometadata',
|
|
39
|
+
'content-type': 'application/json'
|
|
40
|
+
},
|
|
41
|
+
responseType: 'json'
|
|
42
|
+
};
|
|
43
|
+
request_1.default
|
|
44
|
+
.post(requestOptions)
|
|
45
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
46
|
+
}
|
|
47
|
+
options() {
|
|
48
|
+
const options = [
|
|
49
|
+
{
|
|
50
|
+
option: '-u, --webUrl <webUrl>'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
option: '--listItemId <listItemId>'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
option: '-l, --listId [listId]'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
option: '-t, --listTitle [listTitle]'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
option: '-c, --clearExistingPermissions'
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
const parentOptions = super.options();
|
|
66
|
+
return options.concat(parentOptions);
|
|
67
|
+
}
|
|
68
|
+
validate(args) {
|
|
69
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
70
|
+
if (isValidSharePointUrl !== true) {
|
|
71
|
+
return isValidSharePointUrl;
|
|
72
|
+
}
|
|
73
|
+
if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
|
|
74
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
75
|
+
}
|
|
76
|
+
if (isNaN(args.options.listItemId)) {
|
|
77
|
+
return `${args.options.listItemId} is not a number`;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
module.exports = new SpoListItemRoleInheritanceBreakCommand();
|
|
83
|
+
//# sourceMappingURL=listitem-roleinheritance-break.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoListItemRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.LISTITEM_ROLEINHERITANCE_RESET;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Restores the role inheritance of list item, file, or folder';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.listId = typeof args.options.listId !== 'undefined';
|
|
17
|
+
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
18
|
+
return telemetryProps;
|
|
19
|
+
}
|
|
20
|
+
commandAction(logger, args, cb) {
|
|
21
|
+
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
22
|
+
if (args.options.listId) {
|
|
23
|
+
requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
|
|
27
|
+
}
|
|
28
|
+
const requestOptions = {
|
|
29
|
+
url: `${requestUrl}/items(${args.options.listItemId})/resetroleinheritance`,
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
'accept': 'application/json;odata=nometadata',
|
|
33
|
+
'content-type': 'application/json'
|
|
34
|
+
},
|
|
35
|
+
responseType: 'json'
|
|
36
|
+
};
|
|
37
|
+
request_1.default
|
|
38
|
+
.post(requestOptions)
|
|
39
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
40
|
+
}
|
|
41
|
+
optionSets() {
|
|
42
|
+
return [
|
|
43
|
+
['listId', 'listTitle']
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
options() {
|
|
47
|
+
const options = [
|
|
48
|
+
{
|
|
49
|
+
option: '-u, --webUrl <webUrl>'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
option: '--listItemId <listItemId>'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
option: '--listId [listId]'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
option: '--listTitle [listTitle]'
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
const parentOptions = super.options();
|
|
62
|
+
return options.concat(parentOptions);
|
|
63
|
+
}
|
|
64
|
+
validate(args) {
|
|
65
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
66
|
+
if (isValidSharePointUrl !== true) {
|
|
67
|
+
return isValidSharePointUrl;
|
|
68
|
+
}
|
|
69
|
+
if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
|
|
70
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
71
|
+
}
|
|
72
|
+
if (isNaN(args.options.listItemId)) {
|
|
73
|
+
return `${args.options.listItemId} is not a number`;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
module.exports = new SpoListItemRoleInheritanceResetCommand();
|
|
79
|
+
//# sourceMappingURL=listitem-roleinheritance-reset.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoRoleDefinitionListCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.ROLEDEFINITION_LIST;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Gets list of role definitions for the specified site';
|
|
13
|
+
}
|
|
14
|
+
defaultProperties() {
|
|
15
|
+
return ['Id', 'Name'];
|
|
16
|
+
}
|
|
17
|
+
commandAction(logger, args, cb) {
|
|
18
|
+
if (this.verbose) {
|
|
19
|
+
logger.logToStderr(`Getting role definitions list from ${args.options.webUrl}...`);
|
|
20
|
+
}
|
|
21
|
+
const requestOptions = {
|
|
22
|
+
url: `${args.options.webUrl}/_api/web/roledefinitions`,
|
|
23
|
+
headers: {
|
|
24
|
+
'accept': 'application/json;odata=nometadata'
|
|
25
|
+
},
|
|
26
|
+
responseType: 'json'
|
|
27
|
+
};
|
|
28
|
+
request_1.default
|
|
29
|
+
.get(requestOptions)
|
|
30
|
+
.then((response) => {
|
|
31
|
+
logger.log(response.value);
|
|
32
|
+
cb();
|
|
33
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
34
|
+
}
|
|
35
|
+
options() {
|
|
36
|
+
const options = [
|
|
37
|
+
{
|
|
38
|
+
option: '-u, --webUrl <webUrl>'
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
const parentOptions = super.options();
|
|
42
|
+
return options.concat(parentOptions);
|
|
43
|
+
}
|
|
44
|
+
validate(args) {
|
|
45
|
+
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
module.exports = new SpoRoleDefinitionListCommand();
|
|
49
|
+
//# sourceMappingURL=roledefinition-list.js.map
|
|
@@ -96,6 +96,8 @@ exports.default = {
|
|
|
96
96
|
LIST_LABEL_SET: `${prefix} list label set`,
|
|
97
97
|
LIST_LIST: `${prefix} list list`,
|
|
98
98
|
LIST_REMOVE: `${prefix} list remove`,
|
|
99
|
+
LIST_ROLEINHERITANCE_BREAK: `${prefix} list roleinheritance break`,
|
|
100
|
+
LIST_ROLEINHERITANCE_RESET: `${prefix} list roleinheritance reset`,
|
|
99
101
|
LIST_SET: `${prefix} list set`,
|
|
100
102
|
LIST_SITESCRIPT_GET: `${prefix} list sitescript get`,
|
|
101
103
|
LIST_VIEW_GET: `${prefix} list view get`,
|
|
@@ -118,6 +120,8 @@ exports.default = {
|
|
|
118
120
|
LISTITEM_RECORD_DECLARE: `${prefix} listitem record declare`,
|
|
119
121
|
LISTITEM_RECORD_UNDECLARE: `${prefix} listitem record undeclare`,
|
|
120
122
|
LISTITEM_REMOVE: `${prefix} listitem remove`,
|
|
123
|
+
LISTITEM_ROLEINHERITANCE_BREAK: `${prefix} listitem roleinheritance break`,
|
|
124
|
+
LISTITEM_ROLEINHERITANCE_RESET: `${prefix} listitem roleinheritance reset`,
|
|
121
125
|
LISTITEM_SET: `${prefix} listitem set`,
|
|
122
126
|
MAIL_SEND: `${prefix} mail send`,
|
|
123
127
|
NAVIGATION_NODE_ADD: `${prefix} navigation node add`,
|
|
@@ -160,6 +164,7 @@ exports.default = {
|
|
|
160
164
|
REPORT_SITEUSAGEPAGES: `${prefix} report siteusagepages`,
|
|
161
165
|
REPORT_SITEUSAGESITECOUNTS: `${prefix} report siteusagesitecounts`,
|
|
162
166
|
REPORT_SITEUSAGESTORAGE: `${prefix} report siteusagestorage`,
|
|
167
|
+
ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
|
|
163
168
|
SEARCH: `${prefix} search`,
|
|
164
169
|
SERVICEPRINCIPAL_GRANT_ADD: `${prefix} serviceprincipal grant add`,
|
|
165
170
|
SERVICEPRINCIPAL_GRANT_LIST: `${prefix} serviceprincipal grant list`,
|
|
@@ -76,7 +76,7 @@ class TeamsAppListCommand extends GraphCommand_1.default {
|
|
|
76
76
|
commandAction(logger, args, cb) {
|
|
77
77
|
this
|
|
78
78
|
.getEndpointUrl(args)
|
|
79
|
-
.then(endpoint => utils_1.odata.getAllItems(endpoint
|
|
79
|
+
.then(endpoint => utils_1.odata.getAllItems(endpoint))
|
|
80
80
|
.then((items) => {
|
|
81
81
|
if (args.options.teamId || args.options.teamName) {
|
|
82
82
|
items.forEach(t => {
|
|
@@ -53,7 +53,7 @@ class TeamsChannelListCommand extends GraphCommand_1.default {
|
|
|
53
53
|
if (args.options.type) {
|
|
54
54
|
endpoint += `?$filter=membershipType eq '${args.options.type}'`;
|
|
55
55
|
}
|
|
56
|
-
return utils_1.odata.getAllItems(endpoint
|
|
56
|
+
return utils_1.odata.getAllItems(endpoint);
|
|
57
57
|
})
|
|
58
58
|
.then((items) => {
|
|
59
59
|
logger.log(items);
|
|
@@ -40,7 +40,7 @@ class TeamsChannelMemberListCommand extends GraphCommand_1.default {
|
|
|
40
40
|
})
|
|
41
41
|
.then((channelId) => {
|
|
42
42
|
const endpoint = `${this.resource}/v1.0/teams/${this.teamId}/channels/${channelId}/members`;
|
|
43
|
-
return utils_1.odata.getAllItems(endpoint
|
|
43
|
+
return utils_1.odata.getAllItems(endpoint);
|
|
44
44
|
})
|
|
45
45
|
.then((memberships) => {
|
|
46
46
|
if (args.options.role) {
|
|
@@ -33,7 +33,7 @@ class TeamsChatGetCommand extends GraphCommand_1.default {
|
|
|
33
33
|
}
|
|
34
34
|
commandAction(logger, args, cb) {
|
|
35
35
|
this
|
|
36
|
-
.getChatId(
|
|
36
|
+
.getChatId(args)
|
|
37
37
|
.then(chatId => this.getChatDetailsById(chatId))
|
|
38
38
|
.then((chat) => {
|
|
39
39
|
logger.log(chat);
|
|
@@ -83,14 +83,14 @@ class TeamsChatGetCommand extends GraphCommand_1.default {
|
|
|
83
83
|
}
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
86
|
-
getChatId(
|
|
86
|
+
getChatId(args) {
|
|
87
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
88
|
if (args.options.id) {
|
|
89
89
|
return args.options.id;
|
|
90
90
|
}
|
|
91
91
|
return args.options.participants
|
|
92
|
-
? this.getChatIdByParticipants(args.options.participants
|
|
93
|
-
: this.getChatIdByName(args.options.name
|
|
92
|
+
? this.getChatIdByParticipants(args.options.participants)
|
|
93
|
+
: this.getChatIdByName(args.options.name);
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
getChatDetailsById(id) {
|
|
@@ -105,11 +105,11 @@ class TeamsChatGetCommand extends GraphCommand_1.default {
|
|
|
105
105
|
return request_1.default.get(requestOptions);
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
getChatIdByParticipants(participantsString
|
|
108
|
+
getChatIdByParticipants(participantsString) {
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
110
|
const participants = chatUtil_1.chatUtil.convertParticipantStringToArray(participantsString);
|
|
111
111
|
const currentUserEmail = accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken).toLowerCase();
|
|
112
|
-
const existingChats = yield chatUtil_1.chatUtil.findExistingChatsByParticipants([currentUserEmail, ...participants]
|
|
112
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingChatsByParticipants([currentUserEmail, ...participants]);
|
|
113
113
|
if (!existingChats || existingChats.length === 0) {
|
|
114
114
|
throw new Error('No chat conversation was found with these participants.');
|
|
115
115
|
}
|
|
@@ -122,9 +122,9 @@ class TeamsChatGetCommand extends GraphCommand_1.default {
|
|
|
122
122
|
throw new Error(`Multiple chat conversations with these participants found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
getChatIdByName(name
|
|
125
|
+
getChatIdByName(name) {
|
|
126
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const existingChats = yield chatUtil_1.chatUtil.findExistingGroupChatsByName(name
|
|
127
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingGroupChatsByName(name);
|
|
128
128
|
if (!existingChats || existingChats.length === 0) {
|
|
129
129
|
throw new Error('No chat conversation was found with this name.');
|
|
130
130
|
}
|
|
@@ -17,7 +17,7 @@ class TeamsChatListCommand extends GraphCommand_1.default {
|
|
|
17
17
|
const filter = args.options.type !== undefined ? `?$filter=chatType eq '${args.options.type}'` : '';
|
|
18
18
|
const endpoint = `${this.resource}/v1.0/chats${filter}`;
|
|
19
19
|
utils_1.odata
|
|
20
|
-
.getAllItems(endpoint
|
|
20
|
+
.getAllItems(endpoint)
|
|
21
21
|
.then((items) => {
|
|
22
22
|
logger.log(items);
|
|
23
23
|
cb();
|
|
@@ -16,7 +16,7 @@ class TeamsChatMemberListCommand extends GraphCommand_1.default {
|
|
|
16
16
|
commandAction(logger, args, cb) {
|
|
17
17
|
const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/members`;
|
|
18
18
|
utils_1.odata
|
|
19
|
-
.getAllItems(endpoint
|
|
19
|
+
.getAllItems(endpoint)
|
|
20
20
|
.then((items) => {
|
|
21
21
|
logger.log(items);
|
|
22
22
|
cb();
|
|
@@ -16,7 +16,7 @@ class TeamsChatMessageListCommand extends GraphCommand_1.default {
|
|
|
16
16
|
commandAction(logger, args, cb) {
|
|
17
17
|
const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
|
|
18
18
|
utils_1.odata
|
|
19
|
-
.getAllItems(endpoint
|
|
19
|
+
.getAllItems(endpoint)
|
|
20
20
|
.then((items) => {
|
|
21
21
|
if (args.options.output !== 'json') {
|
|
22
22
|
items.forEach(i => {
|
|
@@ -93,15 +93,15 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
93
93
|
return args.options.chatId;
|
|
94
94
|
}
|
|
95
95
|
return args.options.userEmails
|
|
96
|
-
? this.ensureChatIdByUserEmails(args.options.userEmails
|
|
97
|
-
: this.getChatIdByName(args.options.chatName
|
|
96
|
+
? this.ensureChatIdByUserEmails(args.options.userEmails)
|
|
97
|
+
: this.getChatIdByName(args.options.chatName);
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
ensureChatIdByUserEmails(userEmailsOption
|
|
100
|
+
ensureChatIdByUserEmails(userEmailsOption) {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
const userEmails = chatUtil_1.chatUtil.convertParticipantStringToArray(userEmailsOption);
|
|
103
103
|
const currentUserEmail = utils_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken).toLowerCase();
|
|
104
|
-
const existingChats = yield chatUtil_1.chatUtil.findExistingChatsByParticipants([currentUserEmail, ...userEmails]
|
|
104
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingChatsByParticipants([currentUserEmail, ...userEmails]);
|
|
105
105
|
if (!existingChats || existingChats.length === 0) {
|
|
106
106
|
const chat = yield this.createConversation([currentUserEmail, ...userEmails]);
|
|
107
107
|
return chat.id;
|
|
@@ -115,9 +115,9 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
115
115
|
throw new Error(`Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
getChatIdByName(chatName
|
|
118
|
+
getChatIdByName(chatName) {
|
|
119
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
-
const existingChats = yield chatUtil_1.chatUtil.findExistingGroupChatsByName(chatName
|
|
120
|
+
const existingChats = yield chatUtil_1.chatUtil.findExistingGroupChatsByName(chatName);
|
|
121
121
|
if (!existingChats || existingChats.length === 0) {
|
|
122
122
|
throw new Error('No chat conversation was found with this name.');
|
|
123
123
|
}
|
|
@@ -17,12 +17,12 @@ exports.chatUtil = {
|
|
|
17
17
|
* @param expectedMemberEmails a string array of participant emailaddresses
|
|
18
18
|
* @param logger a logger to pipe into the graph request odata helper.
|
|
19
19
|
*/
|
|
20
|
-
findExistingChatsByParticipants(expectedMemberEmails
|
|
20
|
+
findExistingChatsByParticipants(expectedMemberEmails) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const chatType = expectedMemberEmails.length === 2 ? 'oneOnOne' : 'group';
|
|
23
23
|
const endpoint = `https://graph.microsoft.com/v1.0/chats?$filter=chatType eq '${chatType}'&$expand=members&$select=id,topic,createdDateTime,members`;
|
|
24
24
|
const foundChats = [];
|
|
25
|
-
const chats = yield odata_1.odata.getAllItems(endpoint
|
|
25
|
+
const chats = yield odata_1.odata.getAllItems(endpoint);
|
|
26
26
|
for (const chat of chats) {
|
|
27
27
|
const chatMembers = chat.members;
|
|
28
28
|
if (chatMembers.length === expectedMemberEmails.length) {
|
|
@@ -40,10 +40,10 @@ exports.chatUtil = {
|
|
|
40
40
|
* @param name the name of the chat conversation to find
|
|
41
41
|
* @param logger a logger to pipe into the graph request odata helper.
|
|
42
42
|
*/
|
|
43
|
-
findExistingGroupChatsByName(name
|
|
43
|
+
findExistingGroupChatsByName(name) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const endpoint = `https://graph.microsoft.com/v1.0/chats?$filter=topic eq '${encodeURIComponent(name).replace("'", "''")}'&$expand=members&$select=id,topic,createdDateTime,chatType`;
|
|
46
|
-
return odata_1.odata.getAllItems(endpoint
|
|
46
|
+
return odata_1.odata.getAllItems(endpoint);
|
|
47
47
|
});
|
|
48
48
|
},
|
|
49
49
|
/**
|
|
@@ -17,7 +17,7 @@ class TeamsMessageListCommand extends GraphCommand_1.default {
|
|
|
17
17
|
const deltaExtension = args.options.since !== undefined ? `/delta?$filter=lastModifiedDateTime gt ${args.options.since}` : '';
|
|
18
18
|
const endpoint = `${this.resource}/v1.0/teams/${args.options.teamId}/channels/${args.options.channelId}/messages${deltaExtension}`;
|
|
19
19
|
utils_1.odata
|
|
20
|
-
.getAllItems(endpoint
|
|
20
|
+
.getAllItems(endpoint)
|
|
21
21
|
.then((items) => {
|
|
22
22
|
if (args.options.output !== 'json') {
|
|
23
23
|
items.forEach(i => {
|
|
@@ -16,7 +16,7 @@ class TeamsMessageReplyListCommand extends GraphCommand_1.default {
|
|
|
16
16
|
commandAction(logger, args, cb) {
|
|
17
17
|
const endpoint = `${this.resource}/v1.0/teams/${args.options.teamId}/channels/${args.options.channelId}/messages/${args.options.messageId}/replies`;
|
|
18
18
|
utils_1.odata
|
|
19
|
-
.getAllItems(endpoint
|
|
19
|
+
.getAllItems(endpoint)
|
|
20
20
|
.then((items) => {
|
|
21
21
|
if (args.options.output !== 'json') {
|
|
22
22
|
items.forEach(i => {
|
|
@@ -16,7 +16,7 @@ class TeamsTabListCommand extends GraphCommand_1.default {
|
|
|
16
16
|
commandAction(logger, args, cb) {
|
|
17
17
|
const endpoint = `${this.resource}/v1.0/teams/${args.options.teamId}/channels/${encodeURIComponent(args.options.channelId)}/tabs?$expand=teamsApp`;
|
|
18
18
|
utils_1.odata
|
|
19
|
-
.getAllItems(endpoint
|
|
19
|
+
.getAllItems(endpoint)
|
|
20
20
|
.then((items) => {
|
|
21
21
|
items.forEach(i => {
|
|
22
22
|
i.teamsAppTabId = i.teamsApp.id;
|
|
@@ -22,7 +22,7 @@ class TeamsTeamListCommand extends GraphCommand_1.default {
|
|
|
22
22
|
endpoint = `${this.resource}/v1.0/me/joinedTeams`;
|
|
23
23
|
}
|
|
24
24
|
utils_1.odata
|
|
25
|
-
.getAllItems(endpoint
|
|
25
|
+
.getAllItems(endpoint)
|
|
26
26
|
.then((items) => {
|
|
27
27
|
if (args.options.joined) {
|
|
28
28
|
return Promise.resolve(items);
|
|
@@ -24,7 +24,7 @@ class TeamsUserAppListCommand extends GraphCommand_1.default {
|
|
|
24
24
|
.then((_userId) => {
|
|
25
25
|
userId = _userId.value;
|
|
26
26
|
const endpoint = `${this.resource}/v1.0/users/${encodeURIComponent(userId)}/teamwork/installedApps?$expand=teamsAppDefinition`;
|
|
27
|
-
return utils_1.odata.getAllItems(endpoint
|
|
27
|
+
return utils_1.odata.getAllItems(endpoint);
|
|
28
28
|
})
|
|
29
29
|
.then((items) => {
|
|
30
30
|
items.forEach(i => {
|
|
@@ -42,7 +42,7 @@ class TeamsUserListCommand extends GraphCommand_1.default {
|
|
|
42
42
|
}
|
|
43
43
|
getOwners(logger, groupId) {
|
|
44
44
|
const endpoint = `${this.resource}/v1.0/groups/${groupId}/owners?$select=id,displayName,userPrincipalName,userType`;
|
|
45
|
-
return utils_1.odata.getAllItems(endpoint
|
|
45
|
+
return utils_1.odata.getAllItems(endpoint).then((items) => {
|
|
46
46
|
this.items = this.items.concat(items);
|
|
47
47
|
// Currently there is a bug in the Microsoft Graph that returns Owners as
|
|
48
48
|
// userType 'member'. We therefore update all returned user as owner
|
|
@@ -53,7 +53,7 @@ class TeamsUserListCommand extends GraphCommand_1.default {
|
|
|
53
53
|
}
|
|
54
54
|
getMembersAndGuests(logger, groupId) {
|
|
55
55
|
const endpoint = `${this.resource}/v1.0/groups/${groupId}/members?$select=id,displayName,userPrincipalName,userType`;
|
|
56
|
-
return utils_1.odata.getAllItems(endpoint
|
|
56
|
+
return utils_1.odata.getAllItems(endpoint);
|
|
57
57
|
}
|
|
58
58
|
options() {
|
|
59
59
|
const options = [
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class TenantSecurityAlertsListCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.SECURITY_ALERTS_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Gets the security alerts for a tenant';
|
|
12
|
+
}
|
|
13
|
+
getTelemetryProperties(args) {
|
|
14
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
15
|
+
telemetryProps.vendor = typeof args.options.vendor !== 'undefined';
|
|
16
|
+
return telemetryProps;
|
|
17
|
+
}
|
|
18
|
+
defaultProperties() {
|
|
19
|
+
return ['id', 'title', 'severity'];
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
this
|
|
23
|
+
.listAlert(args.options)
|
|
24
|
+
.then((res) => {
|
|
25
|
+
logger.log(res);
|
|
26
|
+
cb();
|
|
27
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
28
|
+
}
|
|
29
|
+
listAlert(options) {
|
|
30
|
+
let queryFilter = '';
|
|
31
|
+
if (options.vendor) {
|
|
32
|
+
let vendorName = options.vendor;
|
|
33
|
+
switch (options.vendor.toLowerCase()) {
|
|
34
|
+
case 'azure security center':
|
|
35
|
+
vendorName = 'ASC';
|
|
36
|
+
break;
|
|
37
|
+
case 'microsoft cloud app security':
|
|
38
|
+
vendorName = 'MCAS';
|
|
39
|
+
break;
|
|
40
|
+
case 'azure active directory identity protection':
|
|
41
|
+
vendorName = 'IPC';
|
|
42
|
+
}
|
|
43
|
+
queryFilter = `?$filter=vendorInformation/provider eq '${encodeURIComponent(vendorName)}'`;
|
|
44
|
+
}
|
|
45
|
+
const requestOptions = {
|
|
46
|
+
url: `${this.resource}/v1.0/security/alerts${queryFilter}`,
|
|
47
|
+
headers: {
|
|
48
|
+
accept: 'application/json;odata.metadata=none'
|
|
49
|
+
},
|
|
50
|
+
responseType: 'json'
|
|
51
|
+
};
|
|
52
|
+
return request_1.default
|
|
53
|
+
.get(requestOptions)
|
|
54
|
+
.then(response => {
|
|
55
|
+
const alertList = response.value;
|
|
56
|
+
if (!alertList) {
|
|
57
|
+
return Promise.reject(`Error fetching security alerts`);
|
|
58
|
+
}
|
|
59
|
+
return Promise.resolve(alertList);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
options() {
|
|
63
|
+
const options = [
|
|
64
|
+
{ option: '--vendor [vendor]' }
|
|
65
|
+
];
|
|
66
|
+
const parentOptions = super.options();
|
|
67
|
+
return options.concat(parentOptions);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
module.exports = new TenantSecurityAlertsListCommand();
|
|
71
|
+
//# sourceMappingURL=security-alerts-list.js.map
|
package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js
CHANGED
|
@@ -19,7 +19,7 @@ class TenantServiceAnnouncementHealthIssueListCommand extends GraphCommand_1.def
|
|
|
19
19
|
endpoint += `?$filter=service eq '${encodeURIComponent(args.options.service)}'`;
|
|
20
20
|
}
|
|
21
21
|
utils_1.odata
|
|
22
|
-
.getAllItems(endpoint
|
|
22
|
+
.getAllItems(endpoint)
|
|
23
23
|
.then((items) => {
|
|
24
24
|
logger.log(items);
|
|
25
25
|
cb();
|
|
@@ -19,7 +19,7 @@ class TenantServiceAnnouncementMessageListCommand extends GraphCommand_1.default
|
|
|
19
19
|
endpoint += `?$filter=services/any(c:c+eq+'${encodeURIComponent(args.options.service)}')`;
|
|
20
20
|
}
|
|
21
21
|
utils_1.odata
|
|
22
|
-
.getAllItems(endpoint
|
|
22
|
+
.getAllItems(endpoint)
|
|
23
23
|
.then((items) => {
|
|
24
24
|
logger.log(items);
|
|
25
25
|
cb();
|
|
@@ -9,6 +9,7 @@ exports.default = {
|
|
|
9
9
|
REPORT_OFFICE365ACTIVATIONSUSERDETAIL: `${prefix} report office365activationsuserdetail`,
|
|
10
10
|
REPORT_OFFICE365ACTIVATIONSUSERCOUNTS: `${prefix} report office365activationsusercounts`,
|
|
11
11
|
REPORT_SERVICESUSERCOUNTS: `${prefix} report servicesusercounts`,
|
|
12
|
+
SECURITY_ALERTS_LIST: `${prefix} security alerts list`,
|
|
12
13
|
SERVICEANNOUNCEMENT_HEALTHISSUE_GET: `${prefix} serviceannouncement healthissue get`,
|
|
13
14
|
SERVICEANNOUNCEMENT_HEALTH_GET: `${prefix} serviceannouncement health get`,
|
|
14
15
|
SERVICEANNOUNCEMENT_HEALTH_LIST: `${prefix} serviceannouncement health list`,
|
|
@@ -15,7 +15,7 @@ class TodoListListCommand extends GraphCommand_1.default {
|
|
|
15
15
|
}
|
|
16
16
|
commandAction(logger, args, cb) {
|
|
17
17
|
utils_1.odata
|
|
18
|
-
.getAllItems(`${this.resource}/v1.0/me/todo/lists
|
|
18
|
+
.getAllItems(`${this.resource}/v1.0/me/todo/lists`)
|
|
19
19
|
.then((items) => {
|
|
20
20
|
logger.log(items);
|
|
21
21
|
cb();
|
|
@@ -45,7 +45,7 @@ class TodoTaskListCommand extends GraphCommand_1.default {
|
|
|
45
45
|
.getTodoListId(args)
|
|
46
46
|
.then((listId) => {
|
|
47
47
|
const endpoint = `${this.resource}/v1.0/me/todo/lists/${listId}/tasks`;
|
|
48
|
-
return utils_1.odata.getAllItems(endpoint
|
|
48
|
+
return utils_1.odata.getAllItems(endpoint);
|
|
49
49
|
})
|
|
50
50
|
.then((items) => {
|
|
51
51
|
if (args.options.output === 'json') {
|
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.accessToken = void 0;
|
|
4
4
|
exports.accessToken = {
|
|
5
|
+
isAppOnlyAccessToken(accessToken) {
|
|
6
|
+
let isAppOnlyAccessToken = false;
|
|
7
|
+
if (!accessToken || accessToken.length === 0) {
|
|
8
|
+
return isAppOnlyAccessToken;
|
|
9
|
+
}
|
|
10
|
+
const chunks = accessToken.split('.');
|
|
11
|
+
if (chunks.length !== 3) {
|
|
12
|
+
return isAppOnlyAccessToken;
|
|
13
|
+
}
|
|
14
|
+
const tokenString = Buffer.from(chunks[1], 'base64').toString();
|
|
15
|
+
try {
|
|
16
|
+
const token = JSON.parse(tokenString);
|
|
17
|
+
isAppOnlyAccessToken = token.idtyp === 'app';
|
|
18
|
+
}
|
|
19
|
+
catch (_a) {
|
|
20
|
+
}
|
|
21
|
+
return isAppOnlyAccessToken;
|
|
22
|
+
},
|
|
5
23
|
getTenantIdFromAccessToken(accessToken) {
|
|
6
24
|
let tenantId = '';
|
|
7
25
|
if (!accessToken || accessToken.length === 0) {
|
package/dist/utils/odata.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.odata = void 0;
|
|
13
13
|
const request_1 = require("../request");
|
|
14
14
|
exports.odata = {
|
|
15
|
-
getAllItems(url,
|
|
15
|
+
getAllItems(url, metadata) {
|
|
16
16
|
var _a;
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
let items = [];
|
|
@@ -27,7 +27,7 @@ exports.odata = {
|
|
|
27
27
|
items = res.value;
|
|
28
28
|
const nextLink = (_a = res['@odata.nextLink']) !== null && _a !== void 0 ? _a : res.nextLink;
|
|
29
29
|
if (nextLink) {
|
|
30
|
-
const nextPageItems = yield exports.odata.getAllItems(nextLink,
|
|
30
|
+
const nextPageItems = yield exports.odata.getAllItems(nextLink, metadata);
|
|
31
31
|
items = items.concat(nextPageItems);
|
|
32
32
|
}
|
|
33
33
|
return items;
|