@pnp/cli-microsoft365 5.9.0-beta.06d9445 → 5.9.0-beta.174dde9
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 +11 -0
- package/README.md +5 -0
- package/dist/m365/pp/commands/card/card-list.js +68 -0
- package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +6 -12
- 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 +2 -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-roleinheritance-break.js +129 -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 +2 -0
- package/dist/m365/teams/commands/channel/channel-add.js +9 -9
- package/docs/docs/cmd/pp/card/card-list.md +33 -0
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +2 -2
- 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-remove.md +69 -0
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
- package/docs/docs/cmd/spo/group/group-list.md +10 -1
- package/docs/docs/cmd/teams/channel/channel-add.md +4 -4
- package/package.json +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +0 -60
|
@@ -16,12 +16,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
var _SpoFileMoveCommand_instances, _SpoFileMoveCommand_initTelemetry, _SpoFileMoveCommand_initOptions, _SpoFileMoveCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const url = require("url");
|
|
19
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
20
|
const request_1 = require("../../../../request");
|
|
20
21
|
const spo_1 = require("../../../../utils/spo");
|
|
21
22
|
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
23
|
const validation_1 = require("../../../../utils/validation");
|
|
23
24
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
25
|
const commands_1 = require("../../commands");
|
|
26
|
+
const removeCommand = require('./file-remove');
|
|
25
27
|
class SpoFileMoveCommand extends SpoCommand_1.default {
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
@@ -124,49 +126,34 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
|
|
|
124
126
|
* Moves file in the site recycle bin
|
|
125
127
|
*/
|
|
126
128
|
recycleFile(tenantUrl, targetUrl, filename, logger) {
|
|
127
|
-
return
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
130
|
const targetFolderAbsoluteUrl = urlUtil_1.urlUtil.urlCombine(tenantUrl, targetUrl);
|
|
129
131
|
// since the target WebFullUrl is unknown we can use getRequestDigest
|
|
130
132
|
// to get it from target folder absolute url.
|
|
131
133
|
// Similar approach used here Microsoft.SharePoint.Client.Web.WebUrlFromFolderUrlDirect
|
|
132
|
-
spo_1.spo.getRequestDigest(targetFolderAbsoluteUrl)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
const contextResponse = yield spo_1.spo.getRequestDigest(targetFolderAbsoluteUrl);
|
|
135
|
+
if (this.debug) {
|
|
136
|
+
logger.logToStderr(`contextResponse.WebFullUrl: ${contextResponse.WebFullUrl}`);
|
|
137
|
+
}
|
|
138
|
+
const targetFileServerRelativeUrl = `${urlUtil_1.urlUtil.getServerRelativePath(contextResponse.WebFullUrl, targetUrl)}/${filename}`;
|
|
139
|
+
const removeOptions = {
|
|
140
|
+
webUrl: contextResponse.WebFullUrl,
|
|
141
|
+
url: targetFileServerRelativeUrl,
|
|
142
|
+
recycle: true,
|
|
143
|
+
confirm: true,
|
|
144
|
+
debug: this.debug,
|
|
145
|
+
verbose: this.verbose
|
|
146
|
+
};
|
|
147
|
+
try {
|
|
148
|
+
yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
if (err.error !== undefined && err.error.message !== undefined && err.error.message.includes('does not exist')) {
|
|
139
152
|
}
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
else {
|
|
154
|
+
throw err;
|
|
142
155
|
}
|
|
143
|
-
|
|
144
|
-
const requestOptions = {
|
|
145
|
-
url: requestUrl,
|
|
146
|
-
method: 'POST',
|
|
147
|
-
headers: {
|
|
148
|
-
'X-HTTP-Method': 'DELETE',
|
|
149
|
-
'If-Match': '*',
|
|
150
|
-
'accept': 'application/json;odata=nometadata'
|
|
151
|
-
},
|
|
152
|
-
responseType: 'json'
|
|
153
|
-
};
|
|
154
|
-
request_1.default.post(requestOptions)
|
|
155
|
-
.then(() => {
|
|
156
|
-
resolve();
|
|
157
|
-
})
|
|
158
|
-
.catch((err) => {
|
|
159
|
-
if (err.statusCode === 404) {
|
|
160
|
-
// file does not exist so can proceed
|
|
161
|
-
return resolve();
|
|
162
|
-
}
|
|
163
|
-
if (this.debug) {
|
|
164
|
-
logger.logToStderr(`recycleFile error...`);
|
|
165
|
-
logger.logToStderr(err);
|
|
166
|
-
}
|
|
167
|
-
reject(err);
|
|
168
|
-
});
|
|
169
|
-
}, (e) => reject(e));
|
|
156
|
+
}
|
|
170
157
|
});
|
|
171
158
|
}
|
|
172
159
|
}
|
|
@@ -79,23 +79,26 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
|
|
|
79
79
|
return request_1.default.get(requestOptions);
|
|
80
80
|
}
|
|
81
81
|
deleteFile(webUrl, sourceUrl, targetFileName) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const targetFileServerRelativeUrl = `${urlUtil_1.urlUtil.getServerRelativePath(webUrl, sourceUrl.substring(0, sourceUrl.lastIndexOf('/')))}/${targetFileName}`;
|
|
84
|
+
const removeOptions = {
|
|
85
|
+
webUrl: webUrl,
|
|
86
|
+
url: targetFileServerRelativeUrl,
|
|
87
|
+
recycle: true,
|
|
88
|
+
confirm: true,
|
|
89
|
+
debug: this.debug,
|
|
90
|
+
verbose: this.verbose
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (err.error !== undefined && err.error.message !== undefined && err.error.message.includes('does not exist')) {
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
|
-
return Promise.reject(err);
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
104
|
}
|
|
@@ -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
|
|
@@ -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); }));
|
|
@@ -56,17 +56,17 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
56
56
|
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
57
57
|
requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
58
58
|
}
|
|
59
|
-
args.options.roleDefinitionId = yield this.
|
|
59
|
+
args.options.roleDefinitionId = yield this.getRoleDefinitionId(args.options);
|
|
60
60
|
if (args.options.upn) {
|
|
61
|
-
args.options.principalId = yield this.
|
|
62
|
-
yield this.
|
|
61
|
+
args.options.principalId = yield this.getUserPrincipalId(args.options);
|
|
62
|
+
yield this.addRoleAssignment(requestUrl, logger, args.options);
|
|
63
63
|
}
|
|
64
64
|
else if (args.options.groupName) {
|
|
65
|
-
args.options.principalId = yield this.
|
|
66
|
-
this.
|
|
65
|
+
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
66
|
+
this.addRoleAssignment(requestUrl, logger, args.options);
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
|
-
yield this.
|
|
69
|
+
yield this.addRoleAssignment(requestUrl, logger, args.options);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
catch (err) {
|
|
@@ -74,7 +74,7 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
addRoleAssignment(requestUrl, logger, options) {
|
|
78
78
|
const requestOptions = {
|
|
79
79
|
url: `${requestUrl}roleassignments/addroleassignment(principalid='${options.principalId}',roledefid='${options.roleDefinitionId}')`,
|
|
80
80
|
method: 'POST',
|
|
@@ -89,7 +89,7 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
89
89
|
.then(_ => Promise.resolve())
|
|
90
90
|
.catch((err) => Promise.reject(err));
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
getRoleDefinitionId(options) {
|
|
93
93
|
if (!options.roleDefinitionName) {
|
|
94
94
|
return Promise.resolve(options.roleDefinitionId);
|
|
95
95
|
}
|
|
@@ -108,7 +108,7 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
108
108
|
return Promise.reject(err);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
getGroupPrincipalId(options) {
|
|
112
112
|
const groupGetCommandOptions = {
|
|
113
113
|
webUrl: options.webUrl,
|
|
114
114
|
name: options.groupName,
|
|
@@ -124,7 +124,7 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
124
124
|
return Promise.reject(err);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
getUserPrincipalId(options) {
|
|
128
128
|
const userGetCommandOptions = {
|
|
129
129
|
webUrl: options.webUrl,
|
|
130
130
|
email: options.upn,
|
|
@@ -57,15 +57,15 @@ class SpoListRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
57
57
|
requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
58
58
|
}
|
|
59
59
|
if (args.options.upn) {
|
|
60
|
-
args.options.principalId = yield this.
|
|
61
|
-
yield this.
|
|
60
|
+
args.options.principalId = yield this.getUserPrincipalId(args.options);
|
|
61
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
62
62
|
}
|
|
63
63
|
else if (args.options.groupName) {
|
|
64
|
-
args.options.principalId = yield this.
|
|
65
|
-
yield this.
|
|
64
|
+
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
65
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
|
-
yield this.
|
|
68
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
catch (err) {
|
|
@@ -88,7 +88,7 @@ class SpoListRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
removeRoleAssignment(requestUrl, logger, options) {
|
|
92
92
|
const requestOptions = {
|
|
93
93
|
url: `${requestUrl}roleassignments/removeroleassignment(principalid='${options.principalId}')`,
|
|
94
94
|
method: 'POST',
|
|
@@ -103,7 +103,7 @@ class SpoListRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
103
103
|
.then(_ => Promise.resolve())
|
|
104
104
|
.catch((err) => Promise.reject(err));
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
getGroupPrincipalId(options) {
|
|
107
107
|
const groupGetCommandOptions = {
|
|
108
108
|
webUrl: options.webUrl,
|
|
109
109
|
name: options.groupName,
|
|
@@ -119,7 +119,7 @@ class SpoListRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
119
119
|
return Promise.reject(err);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
getUserPrincipalId(options) {
|
|
123
123
|
const userGetCommandOptions = {
|
|
124
124
|
webUrl: options.webUrl,
|
|
125
125
|
email: options.upn,
|
|
@@ -58,15 +58,15 @@ class SpoListItemRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
58
58
|
}
|
|
59
59
|
requestUrl += `items(${args.options.listItemId})/`;
|
|
60
60
|
if (args.options.upn) {
|
|
61
|
-
args.options.principalId = yield this.
|
|
62
|
-
yield this.
|
|
61
|
+
args.options.principalId = yield this.getUserPrincipalId(args.options);
|
|
62
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
63
63
|
}
|
|
64
64
|
else if (args.options.groupName) {
|
|
65
|
-
args.options.principalId = yield this.
|
|
66
|
-
yield this.
|
|
65
|
+
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
66
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
|
-
yield this.
|
|
69
|
+
yield this.removeRoleAssignment(requestUrl, logger, args.options);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
catch (err) {
|
|
@@ -89,7 +89,7 @@ class SpoListItemRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
removeRoleAssignment(requestUrl, logger, options) {
|
|
93
93
|
const requestOptions = {
|
|
94
94
|
url: `${requestUrl}roleassignments/removeroleassignment(principalid='${options.principalId}')`,
|
|
95
95
|
method: 'POST',
|
|
@@ -104,7 +104,7 @@ class SpoListItemRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
104
104
|
.then(_ => Promise.resolve())
|
|
105
105
|
.catch((err) => Promise.reject(err));
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
getGroupPrincipalId(options) {
|
|
108
108
|
const groupGetCommandOptions = {
|
|
109
109
|
webUrl: options.webUrl,
|
|
110
110
|
name: options.groupName,
|
|
@@ -120,7 +120,7 @@ class SpoListItemRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
120
120
|
return Promise.reject(err);
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
getUserPrincipalId(options) {
|
|
124
124
|
const userGetCommandOptions = {
|
|
125
125
|
webUrl: options.webUrl,
|
|
126
126
|
email: options.upn,
|
|
@@ -43,17 +43,17 @@ class SpoWebRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
43
43
|
logger.logToStderr(`Adding role assignment to web ${args.options.webUrl}...`);
|
|
44
44
|
}
|
|
45
45
|
try {
|
|
46
|
-
args.options.roleDefinitionId = yield this.
|
|
46
|
+
args.options.roleDefinitionId = yield this.getRoleDefinitionId(args.options);
|
|
47
47
|
if (args.options.upn) {
|
|
48
|
-
args.options.principalId = yield this.
|
|
49
|
-
yield this.
|
|
48
|
+
args.options.principalId = yield this.getUserPrincipalId(args.options);
|
|
49
|
+
yield this.addRoleAssignment(logger, args.options);
|
|
50
50
|
}
|
|
51
51
|
else if (args.options.groupName) {
|
|
52
|
-
args.options.principalId = yield this.
|
|
53
|
-
yield this.
|
|
52
|
+
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
53
|
+
yield this.addRoleAssignment(logger, args.options);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
yield this.
|
|
56
|
+
yield this.addRoleAssignment(logger, args.options);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
catch (err) {
|
|
@@ -61,7 +61,7 @@ class SpoWebRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
addRoleAssignment(logger, options) {
|
|
65
65
|
const requestOptions = {
|
|
66
66
|
url: `${options.webUrl}/_api/web/roleassignments/addroleassignment(principalid='${options.principalId}',roledefid='${options.roleDefinitionId}')`,
|
|
67
67
|
method: 'POST',
|
|
@@ -76,7 +76,7 @@ class SpoWebRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
76
76
|
.then(_ => Promise.resolve())
|
|
77
77
|
.catch((err) => Promise.reject(err));
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
getRoleDefinitionId(options) {
|
|
80
80
|
if (!options.roleDefinitionName) {
|
|
81
81
|
return Promise.resolve(options.roleDefinitionId);
|
|
82
82
|
}
|
|
@@ -95,7 +95,7 @@ class SpoWebRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
95
95
|
return Promise.reject(err);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
getGroupPrincipalId(options) {
|
|
99
99
|
const groupGetCommandOptions = {
|
|
100
100
|
webUrl: options.webUrl,
|
|
101
101
|
name: options.groupName,
|
|
@@ -111,7 +111,7 @@ class SpoWebRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
111
111
|
return Promise.reject(err);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
getUserPrincipalId(options) {
|
|
115
115
|
const userGetCommandOptions = {
|
|
116
116
|
webUrl: options.webUrl,
|
|
117
117
|
email: options.upn,
|
|
@@ -44,15 +44,15 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
44
44
|
}
|
|
45
45
|
try {
|
|
46
46
|
if (args.options.upn) {
|
|
47
|
-
args.options.principalId = yield this.
|
|
48
|
-
yield this.
|
|
47
|
+
args.options.principalId = yield this.getUserPrincipalId(args.options);
|
|
48
|
+
yield this.removeRoleAssignment(logger, args.options);
|
|
49
49
|
}
|
|
50
50
|
else if (args.options.groupName) {
|
|
51
|
-
args.options.principalId = yield this.
|
|
52
|
-
yield this.
|
|
51
|
+
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
52
|
+
yield this.removeRoleAssignment(logger, args.options);
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
yield this.
|
|
55
|
+
yield this.removeRoleAssignment(logger, args.options);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
catch (err) {
|
|
@@ -75,7 +75,7 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
removeRoleAssignment(logger, options) {
|
|
79
79
|
const requestOptions = {
|
|
80
80
|
url: `${options.webUrl}/_api/web/roleassignments/removeroleassignment(principalid='${options.principalId}')`,
|
|
81
81
|
method: 'POST',
|
|
@@ -90,7 +90,7 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
90
90
|
.then(_ => Promise.resolve())
|
|
91
91
|
.catch((err) => Promise.reject(err));
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
getGroupPrincipalId(options) {
|
|
94
94
|
const groupGetCommandOptions = {
|
|
95
95
|
webUrl: options.webUrl,
|
|
96
96
|
name: options.groupName,
|
|
@@ -106,7 +106,7 @@ class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
106
106
|
return Promise.reject(err);
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
getUserPrincipalId(options) {
|
|
110
110
|
const userGetCommandOptions = {
|
|
111
111
|
webUrl: options.webUrl,
|
|
112
112
|
email: options.upn,
|
|
@@ -38,6 +38,7 @@ exports.default = {
|
|
|
38
38
|
CUSTOMACTION_REMOVE: `${prefix} customaction remove`,
|
|
39
39
|
EVENTRECEIVER_GET: `${prefix} eventreceiver get`,
|
|
40
40
|
EVENTRECEIVER_LIST: `${prefix} eventreceiver list`,
|
|
41
|
+
EVENTRECEIVER_REMOVE: `${prefix} eventreceiver remove`,
|
|
41
42
|
EXTERNALUSER_LIST: `${prefix} externaluser list`,
|
|
42
43
|
FEATURE_DISABLE: `${prefix} feature disable`,
|
|
43
44
|
FEATURE_ENABLE: `${prefix} feature enable`,
|
|
@@ -58,6 +59,7 @@ exports.default = {
|
|
|
58
59
|
FILE_RENAME: `${prefix} file rename`,
|
|
59
60
|
FILE_ROLEASSIGNMENT_ADD: `${prefix} file roleassignment add`,
|
|
60
61
|
FILE_ROLEASSIGNMENT_REMOVE: `${prefix} file roleassignment remove`,
|
|
62
|
+
FILE_ROLEINHERITANCE_BREAK: `${prefix} file roleinheritance break`,
|
|
61
63
|
FILE_ROLEINHERITANCE_RESET: `${prefix} file roleinheritance reset`,
|
|
62
64
|
FILE_SHARINGINFO_GET: `${prefix} file sharinginfo get`,
|
|
63
65
|
FOLDER_ADD: `${prefix} folder add`,
|