@pnp/cli-microsoft365 5.9.0-beta.3de06bc → 5.9.0-beta.42a0949
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 +17 -2
- package/README.md +5 -0
- package/dist/m365/aad/commands/app/app-add.js +37 -13
- package/dist/m365/outlook/commands/mail/mail-send.js +55 -31
- package/dist/m365/planner/commands/bucket/bucket-get.js +1 -1
- package/dist/m365/pp/commands/Environment.js +3 -0
- package/dist/m365/pp/commands/card/card-list.js +68 -0
- package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +69 -0
- package/dist/m365/pp/commands/environment/environment-get.js +75 -0
- package/dist/m365/pp/commands/solution/Solution.js +3 -0
- package/dist/m365/pp/commands/solution/solution-list.js +87 -0
- package/dist/m365/pp/commands.js +4 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +0 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +37 -7
- package/dist/m365/spo/commands/eventreceiver/EventReceiver.js +3 -0
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +182 -0
- package/dist/m365/spo/commands/file/file-copy.js +25 -39
- package/dist/m365/spo/commands/file/file-move.js +24 -37
- package/dist/m365/spo/commands/file/file-rename.js +19 -16
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +231 -0
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +129 -0
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +168 -0
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +94 -0
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/group/AssociatedGroupPropertiesCollection.js +3 -0
- package/dist/m365/spo/commands/group/group-list.js +49 -10
- package/dist/m365/spo/commands/list/list-contenttype-add.js +21 -18
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +59 -47
- package/dist/m365/spo/commands/list/list-contenttype-list.js +16 -8
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +16 -8
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +15 -7
- package/dist/m365/spo/commands/list/list-webhook-add.js +19 -11
- package/dist/m365/spo/commands/list/list-webhook-get.js +17 -9
- package/dist/m365/spo/commands/list/list-webhook-list.js +23 -24
- package/dist/m365/spo/commands/list/list-webhook-remove.js +19 -11
- package/dist/m365/spo/commands/list/list-webhook-set.js +18 -10
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands.js +5 -0
- package/dist/m365/teams/commands/channel/channel-add.js +9 -9
- package/dist/m365/todo/commands/task/task-set.js +53 -1
- package/dist/utils/powerPlatform.js +42 -0
- package/docs/docs/_clisettings.md +19 -0
- package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
- package/docs/docs/cmd/pp/card/card-list.md +33 -0
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +33 -0
- package/docs/docs/cmd/pp/environment/environment-get.md +38 -0
- package/docs/docs/cmd/pp/environment/environment-list.md +1 -1
- package/docs/docs/cmd/pp/solution/solution-list.md +33 -0
- package/docs/docs/cmd/spfx/spfx-doctor.md +10 -1
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +2 -2
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-remove.md +69 -0
- package/docs/docs/cmd/spo/file/file-roleassignment-add.md +57 -0
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.md +57 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +39 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +2 -2
- package/docs/docs/cmd/spo/group/group-list.md +10 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-get.md +3 -3
- package/docs/docs/cmd/spo/list/list-contenttype-add.md +16 -7
- package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +16 -7
- package/docs/docs/cmd/spo/list/list-contenttype-list.md +15 -6
- package/docs/docs/cmd/spo/list/list-contenttype-remove.md +17 -8
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +14 -5
- package/docs/docs/cmd/spo/list/list-webhook-add.md +15 -16
- package/docs/docs/cmd/spo/list/list-webhook-get.md +15 -6
- package/docs/docs/cmd/spo/list/list-webhook-list.md +16 -7
- package/docs/docs/cmd/spo/list/list-webhook-remove.md +12 -10
- package/docs/docs/cmd/spo/list/list-webhook-set.md +13 -11
- package/docs/docs/cmd/teams/channel/channel-add.md +4 -4
- package/docs/docs/cmd/todo/task/task-set.md +29 -2
- package/package.json +5 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +0 -60
|
@@ -0,0 +1,231 @@
|
|
|
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 _SpoFileRoleAssignmentAddCommand_instances, _SpoFileRoleAssignmentAddCommand_initTelemetry, _SpoFileRoleAssignmentAddCommand_initOptions, _SpoFileRoleAssignmentAddCommand_initValidators, _SpoFileRoleAssignmentAddCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
20
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
21
|
+
const SpoRoleDefinitionListCommand = require("../roledefinition/roledefinition-list");
|
|
22
|
+
const SpoFileGetCommand = require("./file-get");
|
|
23
|
+
const request_1 = require("../../../../request");
|
|
24
|
+
const validation_1 = require("../../../../utils/validation");
|
|
25
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
26
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
27
|
+
const commands_1 = require("../../commands");
|
|
28
|
+
class SpoFileRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
_SpoFileRoleAssignmentAddCommand_instances.add(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initTelemetry).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initOptions).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initValidators).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initOptionSets).call(this);
|
|
36
|
+
}
|
|
37
|
+
get name() {
|
|
38
|
+
return commands_1.default.FILE_ROLEASSIGNMENT_ADD;
|
|
39
|
+
}
|
|
40
|
+
get description() {
|
|
41
|
+
return 'Adds a role assignment to the specified file.';
|
|
42
|
+
}
|
|
43
|
+
commandAction(logger, args) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
if (this.verbose) {
|
|
46
|
+
logger.logToStderr(`Adding role assignment to file in site at ${args.options.webUrl}...`);
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const fileUrl = yield this.getFileURL(args);
|
|
50
|
+
const roleDefinitionId = yield this.getRoleDefinitionId(args.options);
|
|
51
|
+
if (args.options.upn) {
|
|
52
|
+
const upnPrincipalId = yield this.getUserPrincipalId(args.options);
|
|
53
|
+
yield this.addRoleAssignment(fileUrl, args.options.webUrl, upnPrincipalId, roleDefinitionId);
|
|
54
|
+
}
|
|
55
|
+
else if (args.options.groupName) {
|
|
56
|
+
const groupPrincipalId = yield this.getGroupPrincipalId(args.options);
|
|
57
|
+
yield this.addRoleAssignment(fileUrl, args.options.webUrl, groupPrincipalId, roleDefinitionId);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
yield this.addRoleAssignment(fileUrl, args.options.webUrl, args.options.principalId, roleDefinitionId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
this.handleRejectedODataJsonPromise(err);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
addRoleAssignment(fileUrl, webUrl, principalId, roleDefinitionId) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
const requestOptions = {
|
|
72
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileUrl)}')/ListItemAllFields/roleassignments/addroleassignment(principalid='${principalId}',roledefid='${roleDefinitionId}')`,
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: {
|
|
75
|
+
'accept': 'application/json;odata=nometadata',
|
|
76
|
+
'content-type': 'application/json'
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
yield request_1.default.post(requestOptions);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return Promise.reject(err);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
getRoleDefinitionId(options) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
if (!options.roleDefinitionName) {
|
|
90
|
+
return options.roleDefinitionId;
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const roleDefinitionListCommandOptions = {
|
|
94
|
+
webUrl: options.webUrl,
|
|
95
|
+
output: 'json',
|
|
96
|
+
debug: this.debug,
|
|
97
|
+
verbose: this.verbose
|
|
98
|
+
};
|
|
99
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoRoleDefinitionListCommand, { options: Object.assign(Object.assign({}, roleDefinitionListCommandOptions), { _: [] }) });
|
|
100
|
+
const getRoleDefinitionListOutput = JSON.parse(output.stdout);
|
|
101
|
+
const roleDefinitionId = getRoleDefinitionListOutput.find((role) => role.Name === options.roleDefinitionName).Id;
|
|
102
|
+
return roleDefinitionId;
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
return Promise.reject(err);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
getGroupPrincipalId(options) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
try {
|
|
112
|
+
const groupGetCommandOptions = {
|
|
113
|
+
webUrl: options.webUrl,
|
|
114
|
+
name: options.groupName,
|
|
115
|
+
output: 'json',
|
|
116
|
+
debug: this.debug,
|
|
117
|
+
verbose: this.verbose
|
|
118
|
+
};
|
|
119
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
|
|
120
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
121
|
+
return getGroupOutput.Id;
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return Promise.reject(err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
getUserPrincipalId(options) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
try {
|
|
131
|
+
const userGetCommandOptions = {
|
|
132
|
+
webUrl: options.webUrl,
|
|
133
|
+
email: options.upn,
|
|
134
|
+
id: undefined,
|
|
135
|
+
output: 'json',
|
|
136
|
+
debug: this.debug,
|
|
137
|
+
verbose: this.verbose
|
|
138
|
+
};
|
|
139
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
|
|
140
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
141
|
+
return getUserOutput.Id;
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
return Promise.reject(err);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
getFileURL(args) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
if (args.options.fileUrl) {
|
|
151
|
+
return args.options.fileUrl;
|
|
152
|
+
}
|
|
153
|
+
const options = {
|
|
154
|
+
webUrl: args.options.webUrl,
|
|
155
|
+
id: args.options.fileId,
|
|
156
|
+
output: 'json',
|
|
157
|
+
debug: this.debug,
|
|
158
|
+
verbose: this.verbose
|
|
159
|
+
};
|
|
160
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoFileGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
|
|
161
|
+
const getFileOutput = JSON.parse(output.stdout);
|
|
162
|
+
return getFileOutput.ServerRelativeUrl;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
_SpoFileRoleAssignmentAddCommand_instances = new WeakSet(), _SpoFileRoleAssignmentAddCommand_initTelemetry = function _SpoFileRoleAssignmentAddCommand_initTelemetry() {
|
|
167
|
+
this.telemetry.push((args) => {
|
|
168
|
+
Object.assign(this.telemetryProperties, {
|
|
169
|
+
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
170
|
+
fileId: typeof args.options.fileId !== 'undefined',
|
|
171
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
172
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
173
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
174
|
+
roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
|
|
175
|
+
roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined'
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}, _SpoFileRoleAssignmentAddCommand_initOptions = function _SpoFileRoleAssignmentAddCommand_initOptions() {
|
|
179
|
+
this.options.unshift({
|
|
180
|
+
option: '-u, --webUrl <webUrl>'
|
|
181
|
+
}, {
|
|
182
|
+
option: '--fileUrl [fileUrl]'
|
|
183
|
+
}, {
|
|
184
|
+
option: 'i, --fileId [fileId]'
|
|
185
|
+
}, {
|
|
186
|
+
option: '--principalId [principalId]'
|
|
187
|
+
}, {
|
|
188
|
+
option: '--upn [upn]'
|
|
189
|
+
}, {
|
|
190
|
+
option: '--groupName [groupName]'
|
|
191
|
+
}, {
|
|
192
|
+
option: '--roleDefinitionId [roleDefinitionId]'
|
|
193
|
+
}, {
|
|
194
|
+
option: '--roleDefinitionName [roleDefinitionName]'
|
|
195
|
+
});
|
|
196
|
+
}, _SpoFileRoleAssignmentAddCommand_initValidators = function _SpoFileRoleAssignmentAddCommand_initValidators() {
|
|
197
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
199
|
+
if (isValidSharePointUrl !== true) {
|
|
200
|
+
return isValidSharePointUrl;
|
|
201
|
+
}
|
|
202
|
+
if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
|
|
203
|
+
return `${args.options.fileId} is not a valid GUID`;
|
|
204
|
+
}
|
|
205
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
206
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
207
|
+
}
|
|
208
|
+
if (args.options.roleDefinitionId && isNaN(args.options.roleDefinitionId)) {
|
|
209
|
+
return `Specified roleDefinitionId ${args.options.roleDefinitionId} is not a number`;
|
|
210
|
+
}
|
|
211
|
+
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
212
|
+
if (!principalOptions.some(item => item !== undefined)) {
|
|
213
|
+
return `Specify either principalId, upn or groupName`;
|
|
214
|
+
}
|
|
215
|
+
if (principalOptions.filter(item => item !== undefined).length > 1) {
|
|
216
|
+
return `Specify either principalId, upn or groupName but not multiple`;
|
|
217
|
+
}
|
|
218
|
+
const roleDefinitionOptions = [args.options.roleDefinitionId, args.options.roleDefinitionName];
|
|
219
|
+
if (!roleDefinitionOptions.some(item => item !== undefined)) {
|
|
220
|
+
return `Specify either roleDefinitionId or roleDefinitionName`;
|
|
221
|
+
}
|
|
222
|
+
if (roleDefinitionOptions.filter(item => item !== undefined).length > 1) {
|
|
223
|
+
return `Specify either roleDefinitionId or roleDefinitionName but not multiple`;
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
}));
|
|
227
|
+
}, _SpoFileRoleAssignmentAddCommand_initOptionSets = function _SpoFileRoleAssignmentAddCommand_initOptionSets() {
|
|
228
|
+
this.optionSets.push(['fileId', 'fileUrl']);
|
|
229
|
+
};
|
|
230
|
+
module.exports = new SpoFileRoleAssignmentAddCommand();
|
|
231
|
+
//# sourceMappingURL=file-roleassignment-add.js.map
|
|
@@ -0,0 +1,129 @@
|
|
|
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 _SpoFileRoleInheritanceBreakCommand_instances, _SpoFileRoleInheritanceBreakCommand_initTelemetry, _SpoFileRoleInheritanceBreakCommand_initOptions, _SpoFileRoleInheritanceBreakCommand_initValidators, _SpoFileRoleInheritanceBreakCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
22
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
|
+
const commands_1 = require("../../commands");
|
|
24
|
+
const SpoFileGetCommand = require("./file-get");
|
|
25
|
+
class SpoFileRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
_SpoFileRoleInheritanceBreakCommand_instances.add(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initTelemetry).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initOptions).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initValidators).call(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initOptionSets).call(this);
|
|
33
|
+
}
|
|
34
|
+
get name() {
|
|
35
|
+
return commands_1.default.FILE_ROLEINHERITANCE_BREAK;
|
|
36
|
+
}
|
|
37
|
+
get description() {
|
|
38
|
+
return 'Breaks inheritance of a file. Keeping existing permissions is the default behavior.';
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const breakFileRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const fileURL = yield this.getFileURL(args);
|
|
45
|
+
const keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileURL)}')/ListItemAllFields/breakroleinheritance(${keepExistingPermissions})`,
|
|
48
|
+
headers: {
|
|
49
|
+
accept: 'application/json;odata=nometadata'
|
|
50
|
+
},
|
|
51
|
+
responseType: 'json'
|
|
52
|
+
};
|
|
53
|
+
yield request_1.default.post(requestOptions);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
this.handleRejectedODataJsonPromise(err);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (args.options.confirm) {
|
|
60
|
+
yield breakFileRoleInheritance();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const result = yield Cli_1.Cli.prompt({
|
|
64
|
+
type: 'confirm',
|
|
65
|
+
name: 'continue',
|
|
66
|
+
default: false,
|
|
67
|
+
message: `Are you sure you want to break the role inheritance of file ${args.options.fileUrl || args.options.fileId} located in site ${args.options.webUrl}?`
|
|
68
|
+
});
|
|
69
|
+
if (result.continue) {
|
|
70
|
+
yield breakFileRoleInheritance();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
getFileURL(args) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
if (args.options.fileUrl) {
|
|
78
|
+
return args.options.fileUrl;
|
|
79
|
+
}
|
|
80
|
+
const options = {
|
|
81
|
+
webUrl: args.options.webUrl,
|
|
82
|
+
id: args.options.fileId,
|
|
83
|
+
output: 'json',
|
|
84
|
+
debug: this.debug,
|
|
85
|
+
verbose: this.verbose
|
|
86
|
+
};
|
|
87
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoFileGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
|
|
88
|
+
const getFileOutput = JSON.parse(output.stdout);
|
|
89
|
+
return getFileOutput.ServerRelativeUrl;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
_SpoFileRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoFileRoleInheritanceBreakCommand_initTelemetry = function _SpoFileRoleInheritanceBreakCommand_initTelemetry() {
|
|
94
|
+
this.telemetry.push((args) => {
|
|
95
|
+
Object.assign(this.telemetryProperties, {
|
|
96
|
+
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
97
|
+
fileId: typeof args.options.fileId !== 'undefined',
|
|
98
|
+
clearExistingPermissions: !!args.options.clearExistingPermissions,
|
|
99
|
+
confirm: !!args.options.confirm
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}, _SpoFileRoleInheritanceBreakCommand_initOptions = function _SpoFileRoleInheritanceBreakCommand_initOptions() {
|
|
103
|
+
this.options.unshift({
|
|
104
|
+
option: '-u, --webUrl <webUrl>'
|
|
105
|
+
}, {
|
|
106
|
+
option: '--fileUrl [fileUrl]'
|
|
107
|
+
}, {
|
|
108
|
+
option: 'i, --fileId [fileId]'
|
|
109
|
+
}, {
|
|
110
|
+
option: '-c, --clearExistingPermissions'
|
|
111
|
+
}, {
|
|
112
|
+
option: '--confirm'
|
|
113
|
+
});
|
|
114
|
+
}, _SpoFileRoleInheritanceBreakCommand_initValidators = function _SpoFileRoleInheritanceBreakCommand_initValidators() {
|
|
115
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
117
|
+
if (isValidSharePointUrl !== true) {
|
|
118
|
+
return isValidSharePointUrl;
|
|
119
|
+
}
|
|
120
|
+
if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
|
|
121
|
+
return `${args.options.fileId} is not a valid GUID`;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}));
|
|
125
|
+
}, _SpoFileRoleInheritanceBreakCommand_initOptionSets = function _SpoFileRoleInheritanceBreakCommand_initOptionSets() {
|
|
126
|
+
this.optionSets.push(['fileId', 'fileUrl']);
|
|
127
|
+
};
|
|
128
|
+
module.exports = new SpoFileRoleInheritanceBreakCommand();
|
|
129
|
+
//# sourceMappingURL=file-roleinheritance-break.js.map
|
|
@@ -45,7 +45,7 @@ class SpoFileRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
|
45
45
|
const requestOptions = {
|
|
46
46
|
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileURL)}')/ListItemAllFields/resetroleinheritance`,
|
|
47
47
|
headers: {
|
|
48
|
-
accept: 'application/json;odata
|
|
48
|
+
accept: 'application/json;odata=nometadata'
|
|
49
49
|
},
|
|
50
50
|
responseType: 'json'
|
|
51
51
|
};
|
|
@@ -0,0 +1,168 @@
|
|
|
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 _SpoFolderRoleAssignmentRemoveCommand_instances, _SpoFolderRoleAssignmentRemoveCommand_initTelemetry, _SpoFolderRoleAssignmentRemoveCommand_initOptions, _SpoFolderRoleAssignmentRemoveCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
21
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
|
+
const commands_1 = require("../../commands");
|
|
24
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
25
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
26
|
+
class SpoFolderRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
_SpoFolderRoleAssignmentRemoveCommand_instances.add(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoFolderRoleAssignmentRemoveCommand_instances, "m", _SpoFolderRoleAssignmentRemoveCommand_initTelemetry).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoFolderRoleAssignmentRemoveCommand_instances, "m", _SpoFolderRoleAssignmentRemoveCommand_initOptions).call(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoFolderRoleAssignmentRemoveCommand_instances, "m", _SpoFolderRoleAssignmentRemoveCommand_initValidators).call(this);
|
|
33
|
+
}
|
|
34
|
+
get name() {
|
|
35
|
+
return commands_1.default.FOLDER_ROLEASSIGNMENT_REMOVE;
|
|
36
|
+
}
|
|
37
|
+
get description() {
|
|
38
|
+
return 'Removes a role assignment from the specified folder';
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const removeRoleAssignment = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (this.verbose) {
|
|
44
|
+
logger.logToStderr(`Removing role assignment from folder in site at ${args.options.webUrl}...`);
|
|
45
|
+
}
|
|
46
|
+
const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.folderUrl);
|
|
47
|
+
const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${encodeURIComponent(serverRelativeUrl)}')/ListItemAllFields`;
|
|
48
|
+
try {
|
|
49
|
+
if (args.options.upn) {
|
|
50
|
+
args.options.principalId = yield this.getUserPrincipalId(args.options);
|
|
51
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
52
|
+
}
|
|
53
|
+
else if (args.options.groupName) {
|
|
54
|
+
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
55
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (args.options.confirm) {
|
|
66
|
+
yield removeRoleAssignment();
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const result = yield Cli_1.Cli.prompt({
|
|
70
|
+
type: 'confirm',
|
|
71
|
+
name: 'continue',
|
|
72
|
+
default: false,
|
|
73
|
+
message: `Are you sure you want to remove a role assignment from the folder with url '${args.options.folderUrl}'?`
|
|
74
|
+
});
|
|
75
|
+
if (result.continue) {
|
|
76
|
+
yield removeRoleAssignment();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
removeRoleAssignment(requestUrl, logger, options) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const requestOptions = {
|
|
84
|
+
url: `${requestUrl}/roleassignments/removeroleassignment(principalid='${options.principalId}')`,
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'accept': 'application/json;odata=nometadata',
|
|
88
|
+
'content-type': 'application/json'
|
|
89
|
+
},
|
|
90
|
+
responseType: 'json'
|
|
91
|
+
};
|
|
92
|
+
yield request_1.default.post(requestOptions);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
getGroupPrincipalId(options) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const groupGetCommandOptions = {
|
|
98
|
+
webUrl: options.webUrl,
|
|
99
|
+
name: options.groupName,
|
|
100
|
+
output: 'json',
|
|
101
|
+
debug: this.debug,
|
|
102
|
+
verbose: this.verbose
|
|
103
|
+
};
|
|
104
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
|
|
105
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
106
|
+
return getGroupOutput.Id;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
getUserPrincipalId(options) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const userGetCommandOptions = {
|
|
112
|
+
webUrl: options.webUrl,
|
|
113
|
+
email: options.upn,
|
|
114
|
+
id: undefined,
|
|
115
|
+
output: 'json',
|
|
116
|
+
debug: this.debug,
|
|
117
|
+
verbose: this.verbose
|
|
118
|
+
};
|
|
119
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
|
|
120
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
121
|
+
return getUserOutput.Id;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
_SpoFolderRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoFolderRoleAssignmentRemoveCommand_initTelemetry = function _SpoFolderRoleAssignmentRemoveCommand_initTelemetry() {
|
|
126
|
+
this.telemetry.push((args) => {
|
|
127
|
+
Object.assign(this.telemetryProperties, {
|
|
128
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
129
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
130
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
131
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}, _SpoFolderRoleAssignmentRemoveCommand_initOptions = function _SpoFolderRoleAssignmentRemoveCommand_initOptions() {
|
|
135
|
+
this.options.unshift({
|
|
136
|
+
option: '-u, --webUrl <webUrl>'
|
|
137
|
+
}, {
|
|
138
|
+
option: '-f, --folderUrl <folderUrl>'
|
|
139
|
+
}, {
|
|
140
|
+
option: '--principalId [principalId]'
|
|
141
|
+
}, {
|
|
142
|
+
option: '--upn [upn]'
|
|
143
|
+
}, {
|
|
144
|
+
option: '--groupName [groupName]'
|
|
145
|
+
}, {
|
|
146
|
+
option: '--confirm'
|
|
147
|
+
});
|
|
148
|
+
}, _SpoFolderRoleAssignmentRemoveCommand_initValidators = function _SpoFolderRoleAssignmentRemoveCommand_initValidators() {
|
|
149
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
151
|
+
if (isValidSharePointUrl !== true) {
|
|
152
|
+
return isValidSharePointUrl;
|
|
153
|
+
}
|
|
154
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
155
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
156
|
+
}
|
|
157
|
+
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
158
|
+
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
|
|
159
|
+
return `Specify either principalId id, upn or groupName`;
|
|
160
|
+
}
|
|
161
|
+
if (principalOptions.filter(item => item !== undefined).length === 0) {
|
|
162
|
+
return `Specify at least principalId id, upn or groupName`;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}));
|
|
166
|
+
};
|
|
167
|
+
module.exports = new SpoFolderRoleAssignmentRemoveCommand();
|
|
168
|
+
//# sourceMappingURL=folder-roleassignment-remove.js.map
|
|
@@ -0,0 +1,94 @@
|
|
|
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 _SpoFolderRoleInheritanceBreakCommand_instances, _SpoFolderRoleInheritanceBreakCommand_initTelemetry, _SpoFolderRoleInheritanceBreakCommand_initOptions, _SpoFolderRoleInheritanceBreakCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
21
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
|
+
const commands_1 = require("../../commands");
|
|
24
|
+
class SpoFolderRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
_SpoFolderRoleInheritanceBreakCommand_instances.add(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFolderRoleInheritanceBreakCommand_instances, "m", _SpoFolderRoleInheritanceBreakCommand_initTelemetry).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFolderRoleInheritanceBreakCommand_instances, "m", _SpoFolderRoleInheritanceBreakCommand_initOptions).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoFolderRoleInheritanceBreakCommand_instances, "m", _SpoFolderRoleInheritanceBreakCommand_initValidators).call(this);
|
|
31
|
+
}
|
|
32
|
+
get name() {
|
|
33
|
+
return commands_1.default.FOLDER_ROLEINHERITANCE_BREAK;
|
|
34
|
+
}
|
|
35
|
+
get description() {
|
|
36
|
+
return 'Breaks the role inheritance of a folder. Keeping existing permissions is the default behavior.';
|
|
37
|
+
}
|
|
38
|
+
commandAction(logger, args) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
41
|
+
const breakFolderRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
const requestOptions = {
|
|
44
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(args.options.folderUrl)}')/ListItemAllFields/breakroleinheritance(${keepExistingPermissions})`,
|
|
45
|
+
headers: {
|
|
46
|
+
accept: 'application/json'
|
|
47
|
+
},
|
|
48
|
+
responseType: 'json'
|
|
49
|
+
};
|
|
50
|
+
yield request_1.default.post(requestOptions);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
this.handleRejectedODataJsonPromise(err);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (args.options.confirm) {
|
|
57
|
+
yield breakFolderRoleInheritance();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const result = yield Cli_1.Cli.prompt({
|
|
61
|
+
type: 'confirm',
|
|
62
|
+
name: 'continue',
|
|
63
|
+
default: false,
|
|
64
|
+
message: `Are you sure you want to break the role inheritance of folder ${args.options.folderUrl} located in site ${args.options.webUrl}?`
|
|
65
|
+
});
|
|
66
|
+
if (result.continue) {
|
|
67
|
+
yield breakFolderRoleInheritance();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_SpoFolderRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoFolderRoleInheritanceBreakCommand_initTelemetry = function _SpoFolderRoleInheritanceBreakCommand_initTelemetry() {
|
|
74
|
+
this.telemetry.push((args) => {
|
|
75
|
+
Object.assign(this.telemetryProperties, {
|
|
76
|
+
clearExistingPermissions: !!args.options.clearExistingPermissions,
|
|
77
|
+
confirm: !!args.options.confirm
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}, _SpoFolderRoleInheritanceBreakCommand_initOptions = function _SpoFolderRoleInheritanceBreakCommand_initOptions() {
|
|
81
|
+
this.options.unshift({
|
|
82
|
+
option: '-u, --webUrl <webUrl>'
|
|
83
|
+
}, {
|
|
84
|
+
option: '-f, --folderUrl <folderUrl>'
|
|
85
|
+
}, {
|
|
86
|
+
option: '-c, --clearExistingPermissions'
|
|
87
|
+
}, {
|
|
88
|
+
option: '--confirm'
|
|
89
|
+
});
|
|
90
|
+
}, _SpoFolderRoleInheritanceBreakCommand_initValidators = function _SpoFolderRoleInheritanceBreakCommand_initValidators() {
|
|
91
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
|
|
92
|
+
};
|
|
93
|
+
module.exports = new SpoFolderRoleInheritanceBreakCommand();
|
|
94
|
+
//# sourceMappingURL=folder-roleinheritance-break.js.map
|
|
@@ -41,7 +41,7 @@ class SpoFolderRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
|
41
41
|
const requestOptions = {
|
|
42
42
|
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${args.options.folderUrl}')/ListItemAllFields/resetroleinheritance`,
|
|
43
43
|
headers: {
|
|
44
|
-
accept: 'application/json;odata
|
|
44
|
+
accept: 'application/json;odata=nometadata'
|
|
45
45
|
},
|
|
46
46
|
responseType: 'json'
|
|
47
47
|
};
|