@pnp/cli-microsoft365 5.9.0-beta.bc3200c → 5.9.0-beta.c3fe008
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 +13 -0
- package/README.md +5 -0
- package/dist/appInsights.js +2 -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/solution/Solution.js +3 -0
- package/dist/m365/pp/commands/solution/solution-list.js +87 -0
- package/dist/m365/pp/commands/tenant/tenant-settings-list.js +45 -0
- package/dist/m365/pp/commands.js +5 -1
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +0 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +52 -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-roleassignment-remove.js +180 -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-roleinheritance-break.js +94 -0
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +89 -0
- 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-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +8 -8
- 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 +6 -0
- package/dist/m365/teams/commands/channel/channel-add.js +9 -9
- package/dist/utils/cache.js +81 -0
- package/dist/utils/pid.js +57 -0
- package/dist/utils/powerPlatform.js +42 -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-list.md +1 -1
- package/docs/docs/cmd/pp/solution/solution-list.md +33 -0
- package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +26 -0
- package/docs/docs/cmd/spfx/spfx-doctor.md +10 -1
- 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-roleassignment-remove.md +54 -0
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +39 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +36 -0
- 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/teams/channel/channel-add.md +4 -4
- package/npm-shrinkwrap.json +342 -357
- package/package.json +21 -18
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +0 -60
|
@@ -0,0 +1,180 @@
|
|
|
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 _SpoFileRoleAssignmentRemoveCommand_instances, _SpoFileRoleAssignmentRemoveCommand_initTelemetry, _SpoFileRoleAssignmentRemoveCommand_initOptions, _SpoFileRoleAssignmentRemoveCommand_initValidators, _SpoFileRoleAssignmentRemoveCommand_initOptionSets;
|
|
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 formatting_1 = require("../../../../utils/formatting");
|
|
22
|
+
const validation_1 = require("../../../../utils/validation");
|
|
23
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
|
+
const commands_1 = require("../../commands");
|
|
25
|
+
const SpoFileGetCommand = require("./file-get");
|
|
26
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
27
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
28
|
+
class SpoFileRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
_SpoFileRoleAssignmentRemoveCommand_instances.add(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initTelemetry).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptions).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initValidators).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptionSets).call(this);
|
|
36
|
+
}
|
|
37
|
+
get name() {
|
|
38
|
+
return commands_1.default.FILE_ROLEASSIGNMENT_REMOVE;
|
|
39
|
+
}
|
|
40
|
+
get description() {
|
|
41
|
+
return 'Removes a role assignment from a file.';
|
|
42
|
+
}
|
|
43
|
+
commandAction(logger, args) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const removeRoleAssignment = () => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
try {
|
|
47
|
+
const fileURL = yield this.getFileURL(args);
|
|
48
|
+
let principalId;
|
|
49
|
+
if (args.options.groupName) {
|
|
50
|
+
principalId = yield this.getGroupPrincipalId(args.options);
|
|
51
|
+
}
|
|
52
|
+
else if (args.options.upn) {
|
|
53
|
+
principalId = yield this.getUserPrincipalId(args.options);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
principalId = args.options.principalId;
|
|
57
|
+
}
|
|
58
|
+
const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, fileURL);
|
|
59
|
+
const requestOptions = {
|
|
60
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}')/ListItemAllFields/roleassignments/removeroleassignment(principalid='${principalId}')`,
|
|
61
|
+
headers: {
|
|
62
|
+
accept: 'application/json;odata=nometadata'
|
|
63
|
+
},
|
|
64
|
+
responseType: 'json'
|
|
65
|
+
};
|
|
66
|
+
yield request_1.default.post(requestOptions);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
this.handleRejectedODataJsonPromise(err);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
if (args.options.confirm) {
|
|
73
|
+
yield removeRoleAssignment();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const result = yield Cli_1.Cli.prompt({
|
|
77
|
+
type: 'confirm',
|
|
78
|
+
name: 'continue',
|
|
79
|
+
default: false,
|
|
80
|
+
message: `Are you sure you want to remove role assignment from file ${args.options.fileUrl || args.options.fileId} from site ${args.options.webUrl}?`
|
|
81
|
+
});
|
|
82
|
+
if (result.continue) {
|
|
83
|
+
yield removeRoleAssignment();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getFileURL(args) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (args.options.fileUrl) {
|
|
91
|
+
return args.options.fileUrl;
|
|
92
|
+
}
|
|
93
|
+
const options = {
|
|
94
|
+
webUrl: args.options.webUrl,
|
|
95
|
+
id: args.options.fileId,
|
|
96
|
+
output: 'json',
|
|
97
|
+
debug: this.debug,
|
|
98
|
+
verbose: this.verbose
|
|
99
|
+
};
|
|
100
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoFileGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
|
|
101
|
+
const getFileOutput = JSON.parse(output.stdout);
|
|
102
|
+
return getFileOutput.ServerRelativeUrl;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
getUserPrincipalId(options) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const userGetCommandOptions = {
|
|
108
|
+
webUrl: options.webUrl,
|
|
109
|
+
email: options.upn,
|
|
110
|
+
id: undefined,
|
|
111
|
+
output: 'json',
|
|
112
|
+
debug: this.debug,
|
|
113
|
+
verbose: this.verbose
|
|
114
|
+
};
|
|
115
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
|
|
116
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
117
|
+
return getUserOutput.Id;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
getGroupPrincipalId(options) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const groupGetCommandOptions = {
|
|
123
|
+
webUrl: options.webUrl,
|
|
124
|
+
name: options.groupName,
|
|
125
|
+
output: 'json',
|
|
126
|
+
debug: this.debug,
|
|
127
|
+
verbose: this.verbose
|
|
128
|
+
};
|
|
129
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
|
|
130
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
131
|
+
return getGroupOutput.Id;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_SpoFileRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoFileRoleAssignmentRemoveCommand_initTelemetry = function _SpoFileRoleAssignmentRemoveCommand_initTelemetry() {
|
|
136
|
+
this.telemetry.push((args) => {
|
|
137
|
+
Object.assign(this.telemetryProperties, {
|
|
138
|
+
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
139
|
+
fileId: typeof args.options.fileId !== 'undefined',
|
|
140
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
141
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
142
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
143
|
+
confirm: !!args.options.confirm
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}, _SpoFileRoleAssignmentRemoveCommand_initOptions = function _SpoFileRoleAssignmentRemoveCommand_initOptions() {
|
|
147
|
+
this.options.unshift({
|
|
148
|
+
option: '-u, --webUrl <webUrl>'
|
|
149
|
+
}, {
|
|
150
|
+
option: '--fileUrl [fileUrl]'
|
|
151
|
+
}, {
|
|
152
|
+
option: '-i, --fileId [fileId]'
|
|
153
|
+
}, {
|
|
154
|
+
option: '--principalId [principalId]'
|
|
155
|
+
}, {
|
|
156
|
+
option: '--upn [upn]'
|
|
157
|
+
}, {
|
|
158
|
+
option: '--groupName [groupName]'
|
|
159
|
+
}, {
|
|
160
|
+
option: '--confirm'
|
|
161
|
+
});
|
|
162
|
+
}, _SpoFileRoleAssignmentRemoveCommand_initValidators = function _SpoFileRoleAssignmentRemoveCommand_initValidators() {
|
|
163
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
165
|
+
if (isValidSharePointUrl !== true) {
|
|
166
|
+
return isValidSharePointUrl;
|
|
167
|
+
}
|
|
168
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
169
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
170
|
+
}
|
|
171
|
+
if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
|
|
172
|
+
return `${args.options.fileId} is not a valid GUID`;
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
175
|
+
}));
|
|
176
|
+
}, _SpoFileRoleAssignmentRemoveCommand_initOptionSets = function _SpoFileRoleAssignmentRemoveCommand_initOptionSets() {
|
|
177
|
+
this.optionSets.push(['fileUrl', 'fileId'], ['upn', 'groupName', 'principalId']);
|
|
178
|
+
};
|
|
179
|
+
module.exports = new SpoFileRoleAssignmentRemoveCommand();
|
|
180
|
+
//# sourceMappingURL=file-roleassignment-remove.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,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
|
|
@@ -0,0 +1,89 @@
|
|
|
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 _SpoFolderRoleInheritanceResetCommand_instances, _SpoFolderRoleInheritanceResetCommand_initTelemetry, _SpoFolderRoleInheritanceResetCommand_initOptions, _SpoFolderRoleInheritanceResetCommand_initValidators;
|
|
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 SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
class SpoFolderRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_SpoFolderRoleInheritanceResetCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFolderRoleInheritanceResetCommand_instances, "m", _SpoFolderRoleInheritanceResetCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFolderRoleInheritanceResetCommand_instances, "m", _SpoFolderRoleInheritanceResetCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFolderRoleInheritanceResetCommand_instances, "m", _SpoFolderRoleInheritanceResetCommand_initValidators).call(this);
|
|
30
|
+
}
|
|
31
|
+
get name() {
|
|
32
|
+
return commands_1.default.FOLDER_ROLEINHERITANCE_RESET;
|
|
33
|
+
}
|
|
34
|
+
get description() {
|
|
35
|
+
return 'Restores the role inheritance of a folder';
|
|
36
|
+
}
|
|
37
|
+
commandAction(logger, args) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const resetFolderRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
try {
|
|
41
|
+
const requestOptions = {
|
|
42
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${args.options.folderUrl}')/ListItemAllFields/resetroleinheritance`,
|
|
43
|
+
headers: {
|
|
44
|
+
accept: 'application/json;odata=nometadata'
|
|
45
|
+
},
|
|
46
|
+
responseType: 'json'
|
|
47
|
+
};
|
|
48
|
+
yield request_1.default.post(requestOptions);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
this.handleRejectedODataJsonPromise(err);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
if (args.options.confirm) {
|
|
55
|
+
yield resetFolderRoleInheritance();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const result = yield Cli_1.Cli.prompt({
|
|
59
|
+
type: 'confirm',
|
|
60
|
+
name: 'continue',
|
|
61
|
+
default: false,
|
|
62
|
+
message: `Are you sure you want to reset the role inheritance of folder ${args.options.folderUrl} located in site ${args.options.webUrl}?`
|
|
63
|
+
});
|
|
64
|
+
if (result.continue) {
|
|
65
|
+
yield resetFolderRoleInheritance();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_SpoFolderRoleInheritanceResetCommand_instances = new WeakSet(), _SpoFolderRoleInheritanceResetCommand_initTelemetry = function _SpoFolderRoleInheritanceResetCommand_initTelemetry() {
|
|
72
|
+
this.telemetry.push((args) => {
|
|
73
|
+
Object.assign(this.telemetryProperties, {
|
|
74
|
+
confirm: !!args.options.confirm
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}, _SpoFolderRoleInheritanceResetCommand_initOptions = function _SpoFolderRoleInheritanceResetCommand_initOptions() {
|
|
78
|
+
this.options.unshift({
|
|
79
|
+
option: '-u, --webUrl <webUrl>'
|
|
80
|
+
}, {
|
|
81
|
+
option: '-f, --folderUrl <folderUrl>'
|
|
82
|
+
}, {
|
|
83
|
+
option: '--confirm'
|
|
84
|
+
});
|
|
85
|
+
}, _SpoFolderRoleInheritanceResetCommand_initValidators = function _SpoFolderRoleInheritanceResetCommand_initValidators() {
|
|
86
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
|
|
87
|
+
};
|
|
88
|
+
module.exports = new SpoFolderRoleInheritanceResetCommand();
|
|
89
|
+
//# sourceMappingURL=folder-roleinheritance-reset.js.map
|
|
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
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
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var _SpoGroupListCommand_instances, _SpoGroupListCommand_initOptions, _SpoGroupListCommand_initValidators;
|
|
16
|
+
var _SpoGroupListCommand_instances, _SpoGroupListCommand_initTelemetry, _SpoGroupListCommand_initOptions, _SpoGroupListCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const validation_1 = require("../../../../utils/validation");
|
|
@@ -23,6 +23,7 @@ class SpoGroupListCommand extends SpoCommand_1.default {
|
|
|
23
23
|
constructor() {
|
|
24
24
|
super();
|
|
25
25
|
_SpoGroupListCommand_instances.add(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoGroupListCommand_instances, "m", _SpoGroupListCommand_initTelemetry).call(this);
|
|
26
27
|
__classPrivateFieldGet(this, _SpoGroupListCommand_instances, "m", _SpoGroupListCommand_initOptions).call(this);
|
|
27
28
|
__classPrivateFieldGet(this, _SpoGroupListCommand_instances, "m", _SpoGroupListCommand_initValidators).call(this);
|
|
28
29
|
}
|
|
@@ -33,34 +34,72 @@ class SpoGroupListCommand extends SpoCommand_1.default {
|
|
|
33
34
|
return 'Lists all the groups within specific web';
|
|
34
35
|
}
|
|
35
36
|
defaultProperties() {
|
|
36
|
-
return ['Id', 'Title', 'LoginName', 'IsHiddenInUI', 'PrincipalType'];
|
|
37
|
+
return ['Id', 'Title', 'LoginName', 'IsHiddenInUI', 'PrincipalType', 'Type'];
|
|
37
38
|
}
|
|
38
39
|
commandAction(logger, args) {
|
|
39
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
if (this.verbose) {
|
|
41
42
|
logger.logToStderr(`Retrieving list of groups for specified web at ${args.options.webUrl}...`);
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
+
const baseUrl = `${args.options.webUrl}/_api/web`;
|
|
45
|
+
try {
|
|
46
|
+
if (!args.options.associatedGroupsOnly) {
|
|
47
|
+
yield this.getSiteGroups(baseUrl, logger);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
yield this.getAssociatedGroups(baseUrl, args.options, logger);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
this.handleRejectedODataJsonPromise(err);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getSiteGroups(baseUrl, logger) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
60
|
const requestOptions = {
|
|
45
|
-
url:
|
|
61
|
+
url: baseUrl + '/sitegroups',
|
|
46
62
|
headers: {
|
|
47
63
|
'accept': 'application/json;odata=nometadata'
|
|
48
64
|
},
|
|
49
65
|
responseType: 'json'
|
|
50
66
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
const groupProperties = yield request_1.default.get(requestOptions);
|
|
68
|
+
logger.log(groupProperties.value);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
getAssociatedGroups(baseUrl, options, logger) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const requestOptions = {
|
|
74
|
+
url: baseUrl + '?$expand=AssociatedOwnerGroup,AssociatedMemberGroup,AssociatedVisitorGroup&$select=AssociatedOwnerGroup,AssociatedMemberGroup,AssociatedVisitorGroup',
|
|
75
|
+
headers: {
|
|
76
|
+
'accept': 'application/json;odata=nometadata'
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
const groupProperties = yield request_1.default.get(requestOptions);
|
|
81
|
+
if (!options.output || options.output === 'json') {
|
|
82
|
+
logger.log(groupProperties);
|
|
54
83
|
}
|
|
55
|
-
|
|
56
|
-
|
|
84
|
+
else {
|
|
85
|
+
//converted to text friendly output
|
|
86
|
+
const output = Object.getOwnPropertyNames(groupProperties).map(prop => (Object.assign({ Type: prop }, groupProperties[prop])));
|
|
87
|
+
logger.log(output);
|
|
57
88
|
}
|
|
58
89
|
});
|
|
59
90
|
}
|
|
60
91
|
}
|
|
61
|
-
_SpoGroupListCommand_instances = new WeakSet(),
|
|
92
|
+
_SpoGroupListCommand_instances = new WeakSet(), _SpoGroupListCommand_initTelemetry = function _SpoGroupListCommand_initTelemetry() {
|
|
93
|
+
this.telemetry.push((args) => {
|
|
94
|
+
Object.assign(this.telemetryProperties, {
|
|
95
|
+
associatedGroupsOnly: (!(!args.options.associatedGroupsOnly)).toString()
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}, _SpoGroupListCommand_initOptions = function _SpoGroupListCommand_initOptions() {
|
|
62
99
|
this.options.unshift({
|
|
63
100
|
option: '-u, --webUrl <webUrl>'
|
|
101
|
+
}, {
|
|
102
|
+
option: '--associatedGroupsOnly'
|
|
64
103
|
});
|
|
65
104
|
}, _SpoGroupListCommand_initValidators = function _SpoGroupListCommand_initValidators() {
|
|
66
105
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
|