@pnp/cli-microsoft365 6.0.0-beta.27b9708 → 6.0.0-beta.2979870
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/m365/aad/commands/app/app-add.js +4 -4
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +0 -3
- package/dist/m365/aad/commands.js +0 -1
- package/dist/m365/graph/Changelog.js +3 -0
- package/dist/m365/graph/commands/changelog/changelog-list.js +160 -0
- package/dist/m365/graph/commands.js +1 -0
- package/dist/m365/outlook/commands/mail/mail-send.js +22 -6
- package/dist/m365/outlook/commands.js +1 -2
- package/dist/m365/pp/commands/environment/environment-list.js +1 -1
- package/dist/m365/spo/commands/field/field-set.js +2 -9
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +46 -21
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +42 -17
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +46 -21
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +45 -17
- package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +43 -13
- package/dist/m365/teams/commands/channel/channel-member-add.js +0 -4
- package/dist/m365/teams/commands/channel/channel-member-list.js +0 -4
- package/dist/m365/teams/commands/channel/channel-member-remove.js +0 -4
- package/dist/m365/teams/commands.js +0 -3
- package/dist/utils/fsUtil.js +2 -4
- package/dist/utils/md.js +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +1 -7
- package/docs/docs/cmd/graph/changelog/changelog-list.md +53 -0
- package/docs/docs/cmd/outlook/mail/mail-send.md +45 -8
- package/docs/docs/cmd/pp/environment/environment-list.md +1 -1
- package/docs/docs/cmd/spo/field/field-set.md +0 -3
- package/docs/docs/cmd/spo/list/list-roleassignment-add.md +2 -2
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +2 -2
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -0
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +9 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.md +2 -2
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +9 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +9 -0
- package/docs/docs/cmd/spo/site/site-add.md +2 -2
- package/docs/docs/cmd/spo/site/site-groupify.md +0 -6
- package/docs/docs/cmd/spo/web/web-roleassignment-add.md +2 -2
- package/docs/docs/cmd/spo/web/web-roleinheritance-reset.md +9 -0
- package/docs/docs/cmd/teams/channel/channel-member-add.md +0 -6
- package/docs/docs/cmd/teams/channel/channel-member-list.md +0 -6
- package/docs/docs/cmd/teams/channel/channel-member-remove.md +0 -6
- package/package.json +1 -1
|
@@ -61,9 +61,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
61
61
|
objectId: _appInfo.id,
|
|
62
62
|
tenantId: _appInfo.tenantId
|
|
63
63
|
};
|
|
64
|
-
if (_appInfo.secret) {
|
|
65
|
-
appInfo.secret = _appInfo.secret;
|
|
66
|
-
}
|
|
67
64
|
if (_appInfo.secrets) {
|
|
68
65
|
appInfo.secrets = _appInfo.secrets;
|
|
69
66
|
}
|
|
@@ -558,7 +555,10 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
558
555
|
return this
|
|
559
556
|
.createSecret({ appObjectId: appInfo.id })
|
|
560
557
|
.then(secret => {
|
|
561
|
-
appInfo.
|
|
558
|
+
if (!appInfo.secrets) {
|
|
559
|
+
appInfo.secrets = [];
|
|
560
|
+
}
|
|
561
|
+
appInfo.secrets.push(secret);
|
|
562
562
|
return Promise.resolve(appInfo);
|
|
563
563
|
});
|
|
564
564
|
}
|
|
@@ -34,9 +34,6 @@ class AadO365GroupRecycleBinItemRestoreCommand extends GraphCommand_1.default {
|
|
|
34
34
|
get description() {
|
|
35
35
|
return 'Restores a deleted Microsoft 365 Group';
|
|
36
36
|
}
|
|
37
|
-
alias() {
|
|
38
|
-
return [commands_1.default.O365GROUP_RESTORE];
|
|
39
|
-
}
|
|
40
37
|
commandAction(logger, args, cb) {
|
|
41
38
|
if (this.verbose) {
|
|
42
39
|
logger.logToStderr(`Restoring Microsoft 365 Group: ${args.options.id || args.options.displayName || args.options.mailNickname}...`);
|
|
@@ -38,7 +38,6 @@ exports.default = {
|
|
|
38
38
|
O365GROUP_REPORT_ACTIVITYFILECOUNTS: `${prefix} o365group report activityfilecounts`,
|
|
39
39
|
O365GROUP_REPORT_ACTIVITYGROUPCOUNTS: `${prefix} o365group report activitygroupcounts`,
|
|
40
40
|
O365GROUP_REPORT_ACTIVITYSTORAGE: `${prefix} o365group report activitystorage`,
|
|
41
|
-
O365GROUP_RESTORE: `${prefix} o365group restore`,
|
|
42
41
|
O365GROUP_USER_ADD: `${prefix} o365group user add`,
|
|
43
42
|
O365GROUP_USER_LIST: `${prefix} o365group user list`,
|
|
44
43
|
O365GROUP_USER_REMOVE: `${prefix} o365group user remove`,
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _GraphChangelogListCommand_instances, _GraphChangelogListCommand_initTelemetry, _GraphChangelogListCommand_initOptions, _GraphChangelogListCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const utils_1 = require("../../../../utils");
|
|
19
|
+
const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
|
|
20
|
+
const commands_1 = require("../../commands");
|
|
21
|
+
const request_1 = require("../../../../request");
|
|
22
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
23
|
+
class GraphChangelogListCommand extends AnonymousCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_GraphChangelogListCommand_instances.add(this);
|
|
27
|
+
this.allowedVersions = ['beta', 'v1.0'];
|
|
28
|
+
this.allowedChangeTypes = ['Addition', 'Change', 'Deletion', 'Deprecation'];
|
|
29
|
+
this.allowedServices = [
|
|
30
|
+
'Applications', 'Calendar', 'Change notifications', 'Cloud communications',
|
|
31
|
+
'Compliance', 'Cross-device experiences', 'Customer booking', 'Device and app management',
|
|
32
|
+
'Education', 'Files', 'Financials', 'Groups',
|
|
33
|
+
'Identity and access', 'Mail', 'Notes', 'Notifications',
|
|
34
|
+
'People and workplace intelligence', 'Personal contacts', 'Reports', 'Search',
|
|
35
|
+
'Security', 'Sites and lists', 'Tasks and plans', 'Teamwork',
|
|
36
|
+
'To-do tasks', 'Users', 'Workbooks and charts'
|
|
37
|
+
];
|
|
38
|
+
__classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initTelemetry).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initOptions).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initValidators).call(this);
|
|
41
|
+
}
|
|
42
|
+
get name() {
|
|
43
|
+
return commands_1.default.CHANGELOG_LIST;
|
|
44
|
+
}
|
|
45
|
+
get description() {
|
|
46
|
+
return 'Gets an overview of specific API-level changes in Microsoft Graph v1.0 and beta';
|
|
47
|
+
}
|
|
48
|
+
defaultProperties() {
|
|
49
|
+
return ['category', 'title', 'description'];
|
|
50
|
+
}
|
|
51
|
+
commandAction(logger, args, cb) {
|
|
52
|
+
const allowedChangeType = args.options.changeType && this.allowedChangeTypes.find(x => x.toLocaleLowerCase() === args.options.changeType.toLocaleLowerCase());
|
|
53
|
+
const searchParam = args.options.changeType ? `/?filterBy=${allowedChangeType}` : '';
|
|
54
|
+
const requestOptions = {
|
|
55
|
+
url: `https://developer.microsoft.com/en-us/graph/changelog/rss${searchParam}`,
|
|
56
|
+
headers: {
|
|
57
|
+
'accept': 'text/xml',
|
|
58
|
+
'x-anonymous': 'true'
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
request_1.default
|
|
62
|
+
.get(requestOptions)
|
|
63
|
+
.then((output) => {
|
|
64
|
+
const parser = new xmldom_1.DOMParser();
|
|
65
|
+
const xmlDoc = parser.parseFromString(output.toString(), "text/xml");
|
|
66
|
+
const changelog = this.filterThroughOptions(args.options, this.mapChangelog(xmlDoc, args));
|
|
67
|
+
logger.log(changelog.items);
|
|
68
|
+
cb();
|
|
69
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
70
|
+
}
|
|
71
|
+
filterThroughOptions(options, changelog) {
|
|
72
|
+
let items = changelog.items;
|
|
73
|
+
if (options.services) {
|
|
74
|
+
const allowedServices = this.allowedServices
|
|
75
|
+
.filter(allowedService => options.services.toLocaleLowerCase().split(',').includes(allowedService.toLocaleLowerCase()));
|
|
76
|
+
items = changelog.items.filter(item => allowedServices.includes(item.title));
|
|
77
|
+
}
|
|
78
|
+
if (options.versions) {
|
|
79
|
+
const allowedVersions = this.allowedVersions
|
|
80
|
+
.filter(allowedVersion => options.versions.toLocaleLowerCase().split(',').includes(allowedVersion.toLocaleLowerCase()));
|
|
81
|
+
items = items.filter(item => allowedVersions.includes(item.category));
|
|
82
|
+
}
|
|
83
|
+
if (options.startDate) {
|
|
84
|
+
const startDate = new Date(options.startDate);
|
|
85
|
+
items = items.filter(item => item.pubDate >= startDate);
|
|
86
|
+
}
|
|
87
|
+
if (options.endDate) {
|
|
88
|
+
const endDate = new Date(options.endDate);
|
|
89
|
+
items = items.filter(item => item.pubDate <= endDate);
|
|
90
|
+
}
|
|
91
|
+
// Make sure everything is unique based on the item guid
|
|
92
|
+
items = [...new Map(items.map((item) => [item.guid, item])).values()];
|
|
93
|
+
changelog.items = items.sort((itemA, itemB) => Number(itemB.pubDate) - Number(itemA.pubDate));
|
|
94
|
+
return changelog;
|
|
95
|
+
}
|
|
96
|
+
mapChangelog(xmlDoc, args) {
|
|
97
|
+
const channel = xmlDoc.getElementsByTagName('channel').item(0);
|
|
98
|
+
const changelog = {
|
|
99
|
+
title: channel.getElementsByTagName('title').item(0).textContent,
|
|
100
|
+
description: channel.getElementsByTagName('description').item(0).textContent,
|
|
101
|
+
url: channel.getElementsByTagName('link').item(0).textContent,
|
|
102
|
+
items: []
|
|
103
|
+
};
|
|
104
|
+
Array.from(xmlDoc.getElementsByTagName('item')).forEach((item) => {
|
|
105
|
+
const description = args.options.output === 'text' ?
|
|
106
|
+
utils_1.md.md2plain(item.getElementsByTagName('description').item(0).textContent, '') :
|
|
107
|
+
item.getElementsByTagName('description').item(0).textContent;
|
|
108
|
+
changelog.items.push({
|
|
109
|
+
guid: item.getElementsByTagName('guid').item(0).textContent,
|
|
110
|
+
category: item.getElementsByTagName('category').item(1).textContent,
|
|
111
|
+
title: item.getElementsByTagName('title').item(0).textContent,
|
|
112
|
+
description: args.options.output === 'text' ?
|
|
113
|
+
description.length > 50 ? `${description.substring(0, 47)}...` : description :
|
|
114
|
+
description,
|
|
115
|
+
pubDate: new Date(item.getElementsByTagName('pubDate').item(0).textContent)
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
return changelog;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
_GraphChangelogListCommand_instances = new WeakSet(), _GraphChangelogListCommand_initTelemetry = function _GraphChangelogListCommand_initTelemetry() {
|
|
122
|
+
this.telemetry.push((args) => {
|
|
123
|
+
Object.assign(this.telemetryProperties, {
|
|
124
|
+
versions: typeof args.options.versions !== 'undefined',
|
|
125
|
+
changeType: typeof args.options.changeType !== 'undefined',
|
|
126
|
+
services: typeof args.options.services !== 'undefined',
|
|
127
|
+
startDate: typeof args.options.startDate !== 'undefined',
|
|
128
|
+
endDate: typeof args.options.endDate !== 'undefined'
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}, _GraphChangelogListCommand_initOptions = function _GraphChangelogListCommand_initOptions() {
|
|
132
|
+
this.options.unshift({ option: '-v, --versions [versions]', autocomplete: this.allowedVersions }, { option: "-c, --changeType [changeType]", autocomplete: this.allowedChangeTypes }, { option: "-s, --services [services]", autocomplete: this.allowedServices }, { option: "--startDate [startDate]" }, { option: "--endDate [endDate]" });
|
|
133
|
+
}, _GraphChangelogListCommand_initValidators = function _GraphChangelogListCommand_initValidators() {
|
|
134
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
if (args.options.versions &&
|
|
136
|
+
args.options.versions.toLocaleLowerCase().split(',').some(x => !this.allowedVersions.map(y => y.toLocaleLowerCase()).includes(x))) {
|
|
137
|
+
return `The verions contains an invalid value. Specify either ${this.allowedVersions.join(', ')} as properties`;
|
|
138
|
+
}
|
|
139
|
+
if (args.options.changeType &&
|
|
140
|
+
!this.allowedChangeTypes.map(x => x.toLocaleLowerCase()).includes(args.options.changeType.toLocaleLowerCase())) {
|
|
141
|
+
return `The change type contain an invalid value. Specify either ${this.allowedChangeTypes.join(', ')} as properties`;
|
|
142
|
+
}
|
|
143
|
+
if (args.options.services &&
|
|
144
|
+
args.options.services.toLocaleLowerCase().split(',').some(x => !this.allowedServices.map(y => y.toLocaleLowerCase()).includes(x))) {
|
|
145
|
+
return `The services contains invalid value. Specify either ${this.allowedServices.join(', ')} as properties`;
|
|
146
|
+
}
|
|
147
|
+
if (args.options.startDate && !utils_1.validation.isValidISODate(args.options.startDate)) {
|
|
148
|
+
return 'The startDate is not a valid ISO date string';
|
|
149
|
+
}
|
|
150
|
+
if (args.options.endDate && !utils_1.validation.isValidISODate(args.options.endDate)) {
|
|
151
|
+
return 'The endDate is not a valid ISO date string';
|
|
152
|
+
}
|
|
153
|
+
if (args.options.endDate && args.options.startDate && new Date(args.options.endDate) < new Date(args.options.startDate)) {
|
|
154
|
+
return 'The endDate should be later than startDate';
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}));
|
|
158
|
+
};
|
|
159
|
+
module.exports = new GraphChangelogListCommand();
|
|
160
|
+
//# sourceMappingURL=changelog-list.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const prefix = 'graph';
|
|
4
4
|
exports.default = {
|
|
5
|
+
CHANGELOG_LIST: `${prefix} changelog list`,
|
|
5
6
|
SCHEMAEXTENSION_ADD: `${prefix} schemaextension add`,
|
|
6
7
|
SCHEMAEXTENSION_GET: `${prefix} schemaextension get`,
|
|
7
8
|
SCHEMAEXTENSION_LIST: `${prefix} schemaextension list`,
|
|
@@ -15,6 +15,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _OutlookMailSendCommand_instances, _OutlookMailSendCommand_initTelemetry, _OutlookMailSendCommand_initOptions, _OutlookMailSendCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Auth_1 = require("../../../../Auth");
|
|
19
|
+
const Command_1 = require("../../../../Command");
|
|
18
20
|
const request_1 = require("../../../../request");
|
|
19
21
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
20
22
|
const commands_1 = require("../../commands");
|
|
@@ -30,15 +32,16 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
30
32
|
return commands_1.default.MAIL_SEND;
|
|
31
33
|
}
|
|
32
34
|
get description() {
|
|
33
|
-
return 'Sends e-mail
|
|
34
|
-
}
|
|
35
|
-
alias() {
|
|
36
|
-
return [commands_1.default.SENDMAIL];
|
|
35
|
+
return 'Sends an e-mail';
|
|
37
36
|
}
|
|
38
37
|
commandAction(logger, args, cb) {
|
|
39
38
|
const bodyContents = args.options.bodyContents;
|
|
39
|
+
const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
|
|
40
|
+
if (isAppOnlyAuth === true && !args.options.sender) {
|
|
41
|
+
return cb(new Command_1.CommandError(`Specify a upn or user id in the 'sender' option when using app only authentication.`));
|
|
42
|
+
}
|
|
40
43
|
const requestOptions = {
|
|
41
|
-
url: `${this.resource}/v1.0/me/sendMail`,
|
|
44
|
+
url: `${this.resource}/v1.0/${args.options.sender ? 'users/' + encodeURIComponent(args.options.sender) : 'me'}/sendMail`,
|
|
42
45
|
headers: {
|
|
43
46
|
accept: 'application/json;odata.metadata=none',
|
|
44
47
|
'content-type': 'application/json'
|
|
@@ -62,6 +65,13 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
62
65
|
saveToSentItems: args.options.saveToSentItems
|
|
63
66
|
}
|
|
64
67
|
};
|
|
68
|
+
if (args.options.mailbox) {
|
|
69
|
+
requestOptions.data.message.from = {
|
|
70
|
+
emailAddress: {
|
|
71
|
+
address: args.options.mailbox
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
65
75
|
request_1.default
|
|
66
76
|
.post(requestOptions)
|
|
67
77
|
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
@@ -72,7 +82,9 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
72
82
|
Object.assign(this.telemetryProperties, {
|
|
73
83
|
bodyContents: typeof args.options.bodyContents !== 'undefined',
|
|
74
84
|
bodyContentType: args.options.bodyContentType,
|
|
75
|
-
saveToSentItems: args.options.saveToSentItems
|
|
85
|
+
saveToSentItems: args.options.saveToSentItems,
|
|
86
|
+
mailbox: typeof args.options.mailbox !== 'undefined',
|
|
87
|
+
sender: typeof args.options.sender !== 'undefined'
|
|
76
88
|
});
|
|
77
89
|
});
|
|
78
90
|
}, _OutlookMailSendCommand_initOptions = function _OutlookMailSendCommand_initOptions() {
|
|
@@ -80,6 +92,10 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
80
92
|
option: '-s, --subject <subject>'
|
|
81
93
|
}, {
|
|
82
94
|
option: '-t, --to <to>'
|
|
95
|
+
}, {
|
|
96
|
+
option: '--sender [sender]'
|
|
97
|
+
}, {
|
|
98
|
+
option: '-m, --mailbox [mailbox]'
|
|
83
99
|
}, {
|
|
84
100
|
option: '--bodyContents <bodyContents>'
|
|
85
101
|
}, {
|
|
@@ -17,7 +17,6 @@ exports.default = {
|
|
|
17
17
|
REPORT_MAILBOXUSAGEQUOTASTATUSMAILBOXCOUNTS: `${prefix} report mailboxusagequotastatusmailboxcounts`,
|
|
18
18
|
REPORT_MAILBOXUSAGESTORAGE: `${prefix} report mailboxusagestorage`,
|
|
19
19
|
ROOM_LIST: `${prefix} room list`,
|
|
20
|
-
ROOMLIST_LIST: `${prefix} roomlist list
|
|
21
|
-
SENDMAIL: `${prefix} sendmail`
|
|
20
|
+
ROOMLIST_LIST: `${prefix} roomlist list`
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=commands.js.map
|
|
@@ -64,7 +64,7 @@ _PpEnvironmentListCommand_instances = new WeakSet(), _PpEnvironmentListCommand_i
|
|
|
64
64
|
});
|
|
65
65
|
}, _PpEnvironmentListCommand_initOptions = function _PpEnvironmentListCommand_initOptions() {
|
|
66
66
|
this.options.unshift({
|
|
67
|
-
option: '-a, --asAdmin
|
|
67
|
+
option: '-a, --asAdmin'
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
70
|
module.exports = new PpEnvironmentListCommand();
|
|
@@ -40,9 +40,6 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
42
|
commandAction(logger, args, cb) {
|
|
43
|
-
if (args.options.name) {
|
|
44
|
-
this.warn(logger, `Option 'name' is deprecated. Please use 'title' instead.`);
|
|
45
|
-
}
|
|
46
43
|
let requestDigest = '';
|
|
47
44
|
utils_1.spo
|
|
48
45
|
.getRequestDigest(args.options.webUrl)
|
|
@@ -78,7 +75,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
78
75
|
// retrieve column CSOM object id
|
|
79
76
|
const fieldQuery = args.options.id ?
|
|
80
77
|
`<Method Id="663" ParentId="7" Name="GetById"><Parameters><Parameter Type="Guid">${utils_1.formatting.escapeXml(args.options.id)}</Parameter></Parameters></Method>` :
|
|
81
|
-
`<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.
|
|
78
|
+
`<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.title)}</Parameter></Parameters></Method>`;
|
|
82
79
|
const requestOptions = {
|
|
83
80
|
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
84
81
|
headers: {
|
|
@@ -121,7 +118,6 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
121
118
|
'listId',
|
|
122
119
|
'listTitle',
|
|
123
120
|
'id',
|
|
124
|
-
'name',
|
|
125
121
|
'title',
|
|
126
122
|
'updateExistingLists',
|
|
127
123
|
'debug',
|
|
@@ -140,7 +136,6 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
140
136
|
Object.assign(this.telemetryProperties, {
|
|
141
137
|
id: typeof args.options.id !== 'undefined',
|
|
142
138
|
title: typeof args.options.title !== 'undefined',
|
|
143
|
-
name: typeof args.options.name !== 'undefined',
|
|
144
139
|
listId: typeof args.options.listId !== 'undefined',
|
|
145
140
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
146
141
|
updateExistingLists: !!args.options.updateExistingLists
|
|
@@ -155,8 +150,6 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
155
150
|
option: '--listTitle [listTitle]'
|
|
156
151
|
}, {
|
|
157
152
|
option: '-i, --id [id]'
|
|
158
|
-
}, {
|
|
159
|
-
option: '-n, --name [name]'
|
|
160
153
|
}, {
|
|
161
154
|
option: '-t, --title [title]'
|
|
162
155
|
}, {
|
|
@@ -182,7 +175,7 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
182
175
|
return true;
|
|
183
176
|
}));
|
|
184
177
|
}, _SpoFieldSetCommand_initOptionSets = function _SpoFieldSetCommand_initOptionSets() {
|
|
185
|
-
this.optionSets.push(['id', 'title'
|
|
178
|
+
this.optionSets.push(['id', 'title']);
|
|
186
179
|
};
|
|
187
180
|
module.exports = new SpoFieldSetCommand();
|
|
188
181
|
//# sourceMappingURL=field-set.js.map
|
|
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _SpoListRoleInheritanceBreakCommand_instances, _SpoListRoleInheritanceBreakCommand_initTelemetry, _SpoListRoleInheritanceBreakCommand_initOptions, _SpoListRoleInheritanceBreakCommand_initValidators, _SpoListRoleInheritanceBreakCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const cli_1 = require("../../../../cli");
|
|
18
19
|
const request_1 = require("../../../../request");
|
|
19
20
|
const utils_1 = require("../../../../utils");
|
|
20
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
@@ -35,32 +36,53 @@ class SpoListRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
|
35
36
|
return 'Breaks role inheritance on list or library';
|
|
36
37
|
}
|
|
37
38
|
commandAction(logger, args, cb) {
|
|
39
|
+
var _a;
|
|
38
40
|
if (this.verbose) {
|
|
39
41
|
logger.logToStderr(`Breaking role inheritance of list in site at ${args.options.webUrl}...`);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const breakListRoleInheritance = () => {
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
45
|
+
if (args.options.listId) {
|
|
46
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
50
|
+
}
|
|
51
|
+
let keepExistingPermissions = true;
|
|
52
|
+
if (args.options.clearExistingPermissions) {
|
|
53
|
+
keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
54
|
+
}
|
|
55
|
+
const requestOptions = {
|
|
56
|
+
url: `${requestUrl}/breakroleinheritance(${keepExistingPermissions})`,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: {
|
|
59
|
+
'accept': 'application/json;odata=nometadata',
|
|
60
|
+
'content-type': 'application/json'
|
|
61
|
+
},
|
|
62
|
+
responseType: 'json'
|
|
63
|
+
};
|
|
64
|
+
request_1.default
|
|
65
|
+
.post(requestOptions)
|
|
66
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
67
|
+
};
|
|
68
|
+
if (args.options.confirm) {
|
|
69
|
+
breakListRoleInheritance();
|
|
44
70
|
}
|
|
45
71
|
else {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
cli_1.Cli.prompt({
|
|
73
|
+
type: 'confirm',
|
|
74
|
+
name: 'continue',
|
|
75
|
+
default: false,
|
|
76
|
+
message: `Are you sure you want to break the role inheritance of ${(_a = args.options.listId) !== null && _a !== void 0 ? _a : args.options.listTitle}?`
|
|
77
|
+
}, (result) => {
|
|
78
|
+
if (!result.continue) {
|
|
79
|
+
cb();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
breakListRoleInheritance();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
51
85
|
}
|
|
52
|
-
const requestOptions = {
|
|
53
|
-
url: `${requestUrl}/breakroleinheritance(${keepExistingPermissions})`,
|
|
54
|
-
method: 'POST',
|
|
55
|
-
headers: {
|
|
56
|
-
'accept': 'application/json;odata=nometadata',
|
|
57
|
-
'content-type': 'application/json'
|
|
58
|
-
},
|
|
59
|
-
responseType: 'json'
|
|
60
|
-
};
|
|
61
|
-
request_1.default
|
|
62
|
-
.post(requestOptions)
|
|
63
|
-
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
64
86
|
}
|
|
65
87
|
}
|
|
66
88
|
_SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInheritanceBreakCommand_initTelemetry = function _SpoListRoleInheritanceBreakCommand_initTelemetry() {
|
|
@@ -68,7 +90,8 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
68
90
|
Object.assign(this.telemetryProperties, {
|
|
69
91
|
listId: typeof args.options.listId !== 'undefined',
|
|
70
92
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
71
|
-
clearExistingPermissions: args.options.clearExistingPermissions === true
|
|
93
|
+
clearExistingPermissions: args.options.clearExistingPermissions === true,
|
|
94
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
72
95
|
});
|
|
73
96
|
});
|
|
74
97
|
}, _SpoListRoleInheritanceBreakCommand_initOptions = function _SpoListRoleInheritanceBreakCommand_initOptions() {
|
|
@@ -80,6 +103,8 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
80
103
|
option: '-t, --listTitle [listTitle]'
|
|
81
104
|
}, {
|
|
82
105
|
option: '-c, --clearExistingPermissions'
|
|
106
|
+
}, {
|
|
107
|
+
option: '--confirm'
|
|
83
108
|
});
|
|
84
109
|
}, _SpoListRoleInheritanceBreakCommand_initValidators = function _SpoListRoleInheritanceBreakCommand_initValidators() {
|
|
85
110
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _SpoListRoleInheritanceResetCommand_instances, _SpoListRoleInheritanceResetCommand_initTelemetry, _SpoListRoleInheritanceResetCommand_initOptions, _SpoListRoleInheritanceResetCommand_initValidators, _SpoListRoleInheritanceResetCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const cli_1 = require("../../../../cli");
|
|
18
19
|
const request_1 = require("../../../../request");
|
|
19
20
|
const utils_1 = require("../../../../utils");
|
|
20
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
@@ -35,35 +36,57 @@ class SpoListRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
|
35
36
|
return 'Restores role inheritance on list or library';
|
|
36
37
|
}
|
|
37
38
|
commandAction(logger, args, cb) {
|
|
39
|
+
var _a;
|
|
38
40
|
if (this.verbose) {
|
|
39
41
|
logger.logToStderr(`Restore role inheritance of list in site at ${args.options.webUrl}...`);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const resetListRoleInheritance = () => {
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
45
|
+
if (args.options.listId) {
|
|
46
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
50
|
+
}
|
|
51
|
+
const requestOptions = {
|
|
52
|
+
url: `${requestUrl}/resetroleinheritance`,
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'accept': 'application/json;odata=nometadata',
|
|
56
|
+
'content-type': 'application/json'
|
|
57
|
+
},
|
|
58
|
+
responseType: 'json'
|
|
59
|
+
};
|
|
60
|
+
request_1.default
|
|
61
|
+
.post(requestOptions)
|
|
62
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
63
|
+
};
|
|
64
|
+
if (args.options.confirm) {
|
|
65
|
+
resetListRoleInheritance();
|
|
44
66
|
}
|
|
45
67
|
else {
|
|
46
|
-
|
|
68
|
+
cli_1.Cli.prompt({
|
|
69
|
+
type: 'confirm',
|
|
70
|
+
name: 'continue',
|
|
71
|
+
default: false,
|
|
72
|
+
message: `Are you sure you want to reset the role inheritance of ${(_a = args.options.listId) !== null && _a !== void 0 ? _a : args.options.listTitle}?`
|
|
73
|
+
}, (result) => {
|
|
74
|
+
if (!result.continue) {
|
|
75
|
+
cb();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
resetListRoleInheritance();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
47
81
|
}
|
|
48
|
-
const requestOptions = {
|
|
49
|
-
url: `${requestUrl}/resetroleinheritance`,
|
|
50
|
-
method: 'POST',
|
|
51
|
-
headers: {
|
|
52
|
-
'accept': 'application/json;odata=nometadata',
|
|
53
|
-
'content-type': 'application/json'
|
|
54
|
-
},
|
|
55
|
-
responseType: 'json'
|
|
56
|
-
};
|
|
57
|
-
request_1.default
|
|
58
|
-
.post(requestOptions)
|
|
59
|
-
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
60
82
|
}
|
|
61
83
|
}
|
|
62
84
|
_SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInheritanceResetCommand_initTelemetry = function _SpoListRoleInheritanceResetCommand_initTelemetry() {
|
|
63
85
|
this.telemetry.push((args) => {
|
|
64
86
|
Object.assign(this.telemetryProperties, {
|
|
65
87
|
listId: typeof args.options.listId !== 'undefined',
|
|
66
|
-
listTitle: typeof args.options.listTitle !== 'undefined'
|
|
88
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
89
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
67
90
|
});
|
|
68
91
|
});
|
|
69
92
|
}, _SpoListRoleInheritanceResetCommand_initOptions = function _SpoListRoleInheritanceResetCommand_initOptions() {
|
|
@@ -73,6 +96,8 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
73
96
|
option: '-i, --listId [listId]'
|
|
74
97
|
}, {
|
|
75
98
|
option: '-t, --listTitle [listTitle]'
|
|
99
|
+
}, {
|
|
100
|
+
option: '--confirm'
|
|
76
101
|
});
|
|
77
102
|
}, _SpoListRoleInheritanceResetCommand_initValidators = function _SpoListRoleInheritanceResetCommand_initValidators() {
|
|
78
103
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _SpoListItemRoleInheritanceBreakCommand_instances, _SpoListItemRoleInheritanceBreakCommand_initTelemetry, _SpoListItemRoleInheritanceBreakCommand_initOptions, _SpoListItemRoleInheritanceBreakCommand_initValidators, _SpoListItemRoleInheritanceBreakCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const cli_1 = require("../../../../cli");
|
|
18
19
|
const request_1 = require("../../../../request");
|
|
19
20
|
const utils_1 = require("../../../../utils");
|
|
20
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
@@ -35,32 +36,53 @@ class SpoListItemRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
|
35
36
|
return 'Break inheritance of list item';
|
|
36
37
|
}
|
|
37
38
|
commandAction(logger, args, cb) {
|
|
39
|
+
var _a;
|
|
38
40
|
if (this.verbose) {
|
|
39
41
|
logger.logToStderr(`Breaking role inheritance of list item in site at ${args.options.webUrl}...`);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const breakListItemRoleInheritance = () => {
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
45
|
+
if (args.options.listId) {
|
|
46
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
50
|
+
}
|
|
51
|
+
let keepExistingPermissions = true;
|
|
52
|
+
if (args.options.clearExistingPermissions) {
|
|
53
|
+
keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
54
|
+
}
|
|
55
|
+
const requestOptions = {
|
|
56
|
+
url: `${requestUrl}/items(${args.options.listItemId})/breakroleinheritance(${keepExistingPermissions})`,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: {
|
|
59
|
+
'accept': 'application/json;odata=nometadata',
|
|
60
|
+
'content-type': 'application/json'
|
|
61
|
+
},
|
|
62
|
+
responseType: 'json'
|
|
63
|
+
};
|
|
64
|
+
request_1.default
|
|
65
|
+
.post(requestOptions)
|
|
66
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
67
|
+
};
|
|
68
|
+
if (args.options.confirm) {
|
|
69
|
+
breakListItemRoleInheritance();
|
|
44
70
|
}
|
|
45
71
|
else {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
cli_1.Cli.prompt({
|
|
73
|
+
type: 'confirm',
|
|
74
|
+
name: 'continue',
|
|
75
|
+
default: false,
|
|
76
|
+
message: `Are you sure you want to break the role inheritance of ${args.options.listItemId} in list ${(_a = args.options.listId) !== null && _a !== void 0 ? _a : args.options.listTitle}?`
|
|
77
|
+
}, (result) => {
|
|
78
|
+
if (!result.continue) {
|
|
79
|
+
cb();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
breakListItemRoleInheritance();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
51
85
|
}
|
|
52
|
-
const requestOptions = {
|
|
53
|
-
url: `${requestUrl}/items(${args.options.listItemId})/breakroleinheritance(${keepExistingPermissions})`,
|
|
54
|
-
method: 'POST',
|
|
55
|
-
headers: {
|
|
56
|
-
'accept': 'application/json;odata=nometadata',
|
|
57
|
-
'content-type': 'application/json'
|
|
58
|
-
},
|
|
59
|
-
responseType: 'json'
|
|
60
|
-
};
|
|
61
|
-
request_1.default
|
|
62
|
-
.post(requestOptions)
|
|
63
|
-
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
64
86
|
}
|
|
65
87
|
}
|
|
66
88
|
_SpoListItemRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListItemRoleInheritanceBreakCommand_initTelemetry = function _SpoListItemRoleInheritanceBreakCommand_initTelemetry() {
|
|
@@ -68,7 +90,8 @@ _SpoListItemRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListItemR
|
|
|
68
90
|
Object.assign(this.telemetryProperties, {
|
|
69
91
|
listId: typeof args.options.listId !== 'undefined',
|
|
70
92
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
71
|
-
clearExistingPermissions: args.options.clearExistingPermissions === true
|
|
93
|
+
clearExistingPermissions: args.options.clearExistingPermissions === true,
|
|
94
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
72
95
|
});
|
|
73
96
|
});
|
|
74
97
|
}, _SpoListItemRoleInheritanceBreakCommand_initOptions = function _SpoListItemRoleInheritanceBreakCommand_initOptions() {
|
|
@@ -82,6 +105,8 @@ _SpoListItemRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListItemR
|
|
|
82
105
|
option: '-t, --listTitle [listTitle]'
|
|
83
106
|
}, {
|
|
84
107
|
option: '-c, --clearExistingPermissions'
|
|
108
|
+
}, {
|
|
109
|
+
option: '--confirm'
|
|
85
110
|
});
|
|
86
111
|
}, _SpoListItemRoleInheritanceBreakCommand_initValidators = function _SpoListItemRoleInheritanceBreakCommand_initValidators() {
|
|
87
112
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|