@pnp/cli-microsoft365 5.9.0-beta.60e454b → 5.9.0-beta.6d50b23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Command.js +16 -2
- package/dist/m365/aad/commands/app/app-add.js +37 -13
- package/dist/m365/commands/status.js +6 -1
- package/dist/m365/outlook/commands/mail/mail-send.js +54 -30
- package/dist/m365/pp/commands/card/card-get.js +110 -0
- package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
- package/dist/m365/pp/commands/solution/solution-get.js +117 -0
- package/dist/m365/pp/commands.js +3 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
- package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010001_YORC_version.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010002_YORC_isCreatingSolution.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010003_YORC_packageManager.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010004_YORC_componentType.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010005_YORC_environment.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010006_YORC_framework.js +3 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010007_YORC_isDomainIsolated.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010008_YORC_nodeVersion.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010009_YORC_sdkVersions_microsoft_graph_client.js +56 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010010_YORC_sdkVersions_teams_js.js +56 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.16.0-beta.1.js → upgrade-1.16.0-beta.2.js} +44 -28
- package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +1 -1
- 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-get.js +2 -3
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/todo/commands/task/task-add.js +55 -3
- package/docs/docs/_clisettings.md +19 -0
- package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
- package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
- package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
- package/docs/docs/cmd/planner/plan/plan-get.md +75 -0
- package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
- package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
- package/docs/docs/cmd/pp/card/card-get.md +51 -0
- package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
- package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
- package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
- 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-get.md +2 -2
- package/docs/docs/cmd/spo/list/list-webhook-set.md +3 -3
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
- package/docs/docs/cmd/todo/task/task-add.md +32 -5
- package/package.json +11 -6
|
@@ -19,6 +19,7 @@ const Cli_1 = require("../../../../cli/Cli");
|
|
|
19
19
|
const request_1 = require("../../../../request");
|
|
20
20
|
const formatting_1 = require("../../../../utils/formatting");
|
|
21
21
|
const spo_1 = require("../../../../utils/spo");
|
|
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");
|
|
@@ -72,30 +73,25 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
72
73
|
logger.logToStderr(`WebId: ${webId}`);
|
|
73
74
|
}
|
|
74
75
|
let listId = undefined;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
listId = list.Id;
|
|
87
|
-
if (this.debug) {
|
|
88
|
-
logger.logToStderr(`ListId: ${listId}`);
|
|
89
|
-
}
|
|
76
|
+
if (args.options.listId) {
|
|
77
|
+
listId = args.options.listId;
|
|
78
|
+
}
|
|
79
|
+
else if (args.options.listTitle) {
|
|
80
|
+
listId = yield this.getListIdFromListTitle(args.options.webUrl, args.options.listTitle);
|
|
81
|
+
}
|
|
82
|
+
else if (args.options.listUrl) {
|
|
83
|
+
listId = yield this.getListIdFromListUrl(args.options.webUrl, args.options.listUrl);
|
|
84
|
+
}
|
|
85
|
+
if (this.debug) {
|
|
86
|
+
logger.logToStderr(`ListId: ${listId}`);
|
|
90
87
|
}
|
|
91
88
|
const reqDigest = yield spo_1.spo.getRequestDigest(args.options.webUrl);
|
|
92
89
|
const requestDigest = reqDigest.FormDigestValue;
|
|
93
|
-
const updateChildContentTypes = args.options.listTitle ? false : args.options.updateChildContentTypes === true;
|
|
90
|
+
const updateChildContentTypes = args.options.listTitle || args.options.listId || args.options.listUrl ? false : args.options.updateChildContentTypes === true;
|
|
94
91
|
if (this.debug) {
|
|
95
|
-
const additionalLog = args.options.listTitle ? `; ListTitle='${args.options.listTitle}'` : ` ; UpdateChildContentTypes='${updateChildContentTypes}`;
|
|
92
|
+
const additionalLog = args.options.listTitle ? `; ListTitle='${args.options.listTitle}'` : args.options.listId ? `; ListId='${args.options.listId}'` : args.options.listUrl ? `; ListUrl='${args.options.listUrl}'` : ` ; UpdateChildContentTypes='${updateChildContentTypes}`;
|
|
96
93
|
logger.logToStderr(`Remove FieldLink from ContentType. FieldLinkId='${args.options.fieldLinkId}' ; ContentTypeId='${args.options.contentTypeId}' ${additionalLog}`);
|
|
97
94
|
logger.logToStderr(`Execute ProcessQuery.`);
|
|
98
|
-
logger.logToStderr('');
|
|
99
95
|
}
|
|
100
96
|
let requestBody = '';
|
|
101
97
|
if (listId) {
|
|
@@ -138,13 +134,42 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
138
134
|
}
|
|
139
135
|
});
|
|
140
136
|
}
|
|
137
|
+
getListIdFromListTitle(webUrl, listTitle) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
const requestOptions = {
|
|
140
|
+
url: `${webUrl}/_api/lists/GetByTitle('${formatting_1.formatting.encodeQueryParameter(listTitle)}')?$select=Id`,
|
|
141
|
+
headers: {
|
|
142
|
+
accept: 'application/json;odata=nometadata'
|
|
143
|
+
},
|
|
144
|
+
responseType: 'json'
|
|
145
|
+
};
|
|
146
|
+
const list = yield request_1.default.get(requestOptions);
|
|
147
|
+
return list.Id;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
getListIdFromListUrl(webUrl, listUrl) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(webUrl, listUrl);
|
|
153
|
+
const requestOptions = {
|
|
154
|
+
url: `${webUrl}/_api/web/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=Id`,
|
|
155
|
+
headers: {
|
|
156
|
+
accept: 'application/json;odata=nometadata'
|
|
157
|
+
},
|
|
158
|
+
responseType: 'json'
|
|
159
|
+
};
|
|
160
|
+
const list = yield request_1.default.get(requestOptions);
|
|
161
|
+
return list.Id;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
141
164
|
}
|
|
142
165
|
_SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFieldRemoveCommand_initTelemetry = function _SpoContentTypeFieldRemoveCommand_initTelemetry() {
|
|
143
166
|
this.telemetry.push((args) => {
|
|
144
167
|
Object.assign(this.telemetryProperties, {
|
|
145
|
-
listTitle:
|
|
146
|
-
|
|
147
|
-
|
|
168
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
169
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
170
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
171
|
+
updateChildContentTypes: !!args.options.updateChildContentTypes,
|
|
172
|
+
confirm: !!args.options.confirm
|
|
148
173
|
});
|
|
149
174
|
});
|
|
150
175
|
}, _SpoContentTypeFieldRemoveCommand_initOptions = function _SpoContentTypeFieldRemoveCommand_initOptions() {
|
|
@@ -152,6 +177,10 @@ _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFiel
|
|
|
152
177
|
option: '-u, --webUrl <webUrl>'
|
|
153
178
|
}, {
|
|
154
179
|
option: '-l, --listTitle [listTitle]'
|
|
180
|
+
}, {
|
|
181
|
+
option: '--listId [listId]'
|
|
182
|
+
}, {
|
|
183
|
+
option: '--listUrl [listUrl]'
|
|
155
184
|
}, {
|
|
156
185
|
option: '-i, --contentTypeId <contentTypeId>'
|
|
157
186
|
}, {
|
|
@@ -166,6 +195,9 @@ _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFiel
|
|
|
166
195
|
if (!validation_1.validation.isValidGuid(args.options.fieldLinkId)) {
|
|
167
196
|
return `${args.options.fieldLinkId} is not a valid GUID`;
|
|
168
197
|
}
|
|
198
|
+
if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
|
|
199
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
200
|
+
}
|
|
169
201
|
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
170
202
|
}));
|
|
171
203
|
}, _SpoContentTypeFieldRemoveCommand_initTypes = function _SpoContentTypeFieldRemoveCommand_initTypes() {
|
|
@@ -17,6 +17,7 @@ var _SpoContentTypeGetCommand_instances, _SpoContentTypeGetCommand_initTelemetry
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
20
21
|
const validation_1 = require("../../../../utils/validation");
|
|
21
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
23
|
const commands_1 = require("../../commands");
|
|
@@ -38,21 +39,32 @@ class SpoContentTypeGetCommand extends SpoCommand_1.default {
|
|
|
38
39
|
}
|
|
39
40
|
commandAction(logger, args) {
|
|
40
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
43
|
+
if (args.options.listId) {
|
|
44
|
+
requestUrl += `/lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
45
|
+
}
|
|
46
|
+
else if (args.options.listTitle) {
|
|
47
|
+
requestUrl += `/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
48
|
+
}
|
|
49
|
+
else if (args.options.listUrl) {
|
|
50
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
51
|
+
requestUrl += `/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
52
|
+
}
|
|
53
|
+
requestUrl += "/contenttypes";
|
|
54
|
+
if (args.options.id) {
|
|
55
|
+
requestUrl += `('${encodeURIComponent(args.options.id)}')`;
|
|
56
|
+
}
|
|
57
|
+
else if (args.options.name) {
|
|
58
|
+
requestUrl += `?$filter=Name eq '${encodeURIComponent(args.options.name)}'`;
|
|
59
|
+
}
|
|
60
|
+
const requestOptions = {
|
|
61
|
+
url: requestUrl,
|
|
62
|
+
headers: {
|
|
63
|
+
accept: 'application/json;odata=nometadata'
|
|
64
|
+
},
|
|
65
|
+
responseType: 'json'
|
|
66
|
+
};
|
|
41
67
|
try {
|
|
42
|
-
let requestUrl = `${args.options.webUrl}/_api/web/${(args.options.listTitle ? `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/` : '')}contenttypes`;
|
|
43
|
-
if (args.options.id) {
|
|
44
|
-
requestUrl += `('${encodeURIComponent(args.options.id)}')`;
|
|
45
|
-
}
|
|
46
|
-
else if (args.options.name) {
|
|
47
|
-
requestUrl += `?$filter=Name eq '${encodeURIComponent(args.options.name)}'`;
|
|
48
|
-
}
|
|
49
|
-
const requestOptions = {
|
|
50
|
-
url: requestUrl,
|
|
51
|
-
headers: {
|
|
52
|
-
accept: 'application/json;odata=nometadata'
|
|
53
|
-
},
|
|
54
|
-
responseType: 'json'
|
|
55
|
-
};
|
|
56
68
|
let res = yield request_1.default.get(requestOptions);
|
|
57
69
|
let errorMessage = '';
|
|
58
70
|
if (args.options.name) {
|
|
@@ -80,7 +92,9 @@ class SpoContentTypeGetCommand extends SpoCommand_1.default {
|
|
|
80
92
|
_SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_initTelemetry = function _SpoContentTypeGetCommand_initTelemetry() {
|
|
81
93
|
this.telemetry.push((args) => {
|
|
82
94
|
Object.assign(this.telemetryProperties, {
|
|
95
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
83
96
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
97
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
84
98
|
id: typeof args.options.id !== 'undefined',
|
|
85
99
|
name: typeof args.options.name !== 'undefined'
|
|
86
100
|
});
|
|
@@ -90,6 +104,10 @@ _SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_i
|
|
|
90
104
|
option: '-u, --webUrl <webUrl>'
|
|
91
105
|
}, {
|
|
92
106
|
option: '-l, --listTitle [listTitle]'
|
|
107
|
+
}, {
|
|
108
|
+
option: '--listId [listId]'
|
|
109
|
+
}, {
|
|
110
|
+
option: '--listUrl [listUrl]'
|
|
93
111
|
}, {
|
|
94
112
|
option: '-i, --id [id]'
|
|
95
113
|
}, {
|
|
@@ -101,6 +119,9 @@ _SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_i
|
|
|
101
119
|
if (isValidSharePointUrl !== true) {
|
|
102
120
|
return isValidSharePointUrl;
|
|
103
121
|
}
|
|
122
|
+
if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
|
|
123
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
124
|
+
}
|
|
104
125
|
return true;
|
|
105
126
|
}));
|
|
106
127
|
}, _SpoContentTypeGetCommand_initTypes = function _SpoContentTypeGetCommand_initTypes() {
|
|
@@ -63,7 +63,7 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
63
63
|
}
|
|
64
64
|
else if (args.options.groupName) {
|
|
65
65
|
args.options.principalId = yield this.getGroupPrincipalId(args.options);
|
|
66
|
-
this.addRoleAssignment(requestUrl, logger, args.options);
|
|
66
|
+
yield this.addRoleAssignment(requestUrl, logger, args.options);
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
69
|
yield this.addRoleAssignment(requestUrl, logger, args.options);
|
|
@@ -17,6 +17,7 @@ var _SpoListRoleInheritanceBreakCommand_instances, _SpoListRoleInheritanceBreakC
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
20
21
|
const validation_1 = require("../../../../utils/validation");
|
|
21
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
23
|
const commands_1 = require("../../commands");
|
|
@@ -40,19 +41,23 @@ class SpoListRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
|
40
41
|
if (this.verbose) {
|
|
41
42
|
logger.logToStderr(`Breaking role inheritance of list in site at ${args.options.webUrl}...`);
|
|
42
43
|
}
|
|
43
|
-
let requestUrl = `${args.options.webUrl}/_api/web
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
44
45
|
if (args.options.listId) {
|
|
45
|
-
requestUrl += `(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')
|
|
46
|
+
requestUrl += `lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
46
47
|
}
|
|
47
|
-
else {
|
|
48
|
-
requestUrl +=
|
|
48
|
+
else if (args.options.listTitle) {
|
|
49
|
+
requestUrl += `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.listUrl) {
|
|
52
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
53
|
+
requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
49
54
|
}
|
|
50
55
|
let keepExistingPermissions = true;
|
|
51
56
|
if (args.options.clearExistingPermissions) {
|
|
52
57
|
keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
53
58
|
}
|
|
54
59
|
const requestOptions = {
|
|
55
|
-
url: `${requestUrl}
|
|
60
|
+
url: `${requestUrl}breakroleinheritance(${keepExistingPermissions})`,
|
|
56
61
|
method: 'POST',
|
|
57
62
|
headers: {
|
|
58
63
|
'accept': 'application/json;odata=nometadata',
|
|
@@ -74,6 +79,7 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
74
79
|
Object.assign(this.telemetryProperties, {
|
|
75
80
|
listId: typeof args.options.listId !== 'undefined',
|
|
76
81
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
82
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
77
83
|
clearExistingPermissions: args.options.clearExistingPermissions === true
|
|
78
84
|
});
|
|
79
85
|
});
|
|
@@ -84,6 +90,8 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
84
90
|
option: '-i, --listId [listId]'
|
|
85
91
|
}, {
|
|
86
92
|
option: '-t, --listTitle [listTitle]'
|
|
93
|
+
}, {
|
|
94
|
+
option: '--listUrl [listUrl]'
|
|
87
95
|
}, {
|
|
88
96
|
option: '-c, --clearExistingPermissions'
|
|
89
97
|
});
|
|
@@ -99,7 +107,7 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
99
107
|
return true;
|
|
100
108
|
}));
|
|
101
109
|
}, _SpoListRoleInheritanceBreakCommand_initOptionSets = function _SpoListRoleInheritanceBreakCommand_initOptionSets() {
|
|
102
|
-
this.optionSets.push(['listId', 'listTitle']);
|
|
110
|
+
this.optionSets.push(['listId', 'listTitle', 'listUrl']);
|
|
103
111
|
};
|
|
104
112
|
module.exports = new SpoListRoleInheritanceBreakCommand();
|
|
105
113
|
//# sourceMappingURL=list-roleinheritance-break.js.map
|
|
@@ -17,6 +17,7 @@ var _SpoListRoleInheritanceResetCommand_instances, _SpoListRoleInheritanceResetC
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
20
21
|
const validation_1 = require("../../../../utils/validation");
|
|
21
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
23
|
const commands_1 = require("../../commands");
|
|
@@ -40,15 +41,19 @@ class SpoListRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
|
40
41
|
if (this.verbose) {
|
|
41
42
|
logger.logToStderr(`Restore role inheritance of list in site at ${args.options.webUrl}...`);
|
|
42
43
|
}
|
|
43
|
-
let requestUrl = `${args.options.webUrl}/_api/web
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
44
45
|
if (args.options.listId) {
|
|
45
|
-
requestUrl += `(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')
|
|
46
|
+
requestUrl += `lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
46
47
|
}
|
|
47
|
-
else {
|
|
48
|
-
requestUrl +=
|
|
48
|
+
else if (args.options.listTitle) {
|
|
49
|
+
requestUrl += `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.listUrl) {
|
|
52
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
53
|
+
requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
49
54
|
}
|
|
50
55
|
const requestOptions = {
|
|
51
|
-
url: `${requestUrl}
|
|
56
|
+
url: `${requestUrl}resetroleinheritance`,
|
|
52
57
|
method: 'POST',
|
|
53
58
|
headers: {
|
|
54
59
|
'accept': 'application/json;odata=nometadata',
|
|
@@ -69,7 +74,8 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
69
74
|
this.telemetry.push((args) => {
|
|
70
75
|
Object.assign(this.telemetryProperties, {
|
|
71
76
|
listId: typeof args.options.listId !== 'undefined',
|
|
72
|
-
listTitle: typeof args.options.listTitle !== 'undefined'
|
|
77
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
78
|
+
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
73
79
|
});
|
|
74
80
|
});
|
|
75
81
|
}, _SpoListRoleInheritanceResetCommand_initOptions = function _SpoListRoleInheritanceResetCommand_initOptions() {
|
|
@@ -79,6 +85,8 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
79
85
|
option: '-i, --listId [listId]'
|
|
80
86
|
}, {
|
|
81
87
|
option: '-t, --listTitle [listTitle]'
|
|
88
|
+
}, {
|
|
89
|
+
option: '--listUrl [listUrl]'
|
|
82
90
|
});
|
|
83
91
|
}, _SpoListRoleInheritanceResetCommand_initValidators = function _SpoListRoleInheritanceResetCommand_initValidators() {
|
|
84
92
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -92,7 +100,7 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
|
|
|
92
100
|
return true;
|
|
93
101
|
}));
|
|
94
102
|
}, _SpoListRoleInheritanceResetCommand_initOptionSets = function _SpoListRoleInheritanceResetCommand_initOptionSets() {
|
|
95
|
-
this.optionSets.push(['listId', 'listTitle']);
|
|
103
|
+
this.optionSets.push(['listId', 'listTitle', 'listUrl']);
|
|
96
104
|
};
|
|
97
105
|
module.exports = new SpoListRoleInheritanceResetCommand();
|
|
98
106
|
//# sourceMappingURL=list-roleinheritance-reset.js.map
|
|
@@ -79,8 +79,7 @@ _SpoListWebhookGetCommand_instances = new WeakSet(), _SpoListWebhookGetCommand_i
|
|
|
79
79
|
Object.assign(this.telemetryProperties, {
|
|
80
80
|
listId: typeof args.options.listId !== 'undefined',
|
|
81
81
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
82
|
-
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
83
|
-
id: typeof args.options.id !== 'undefined'
|
|
82
|
+
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
84
83
|
});
|
|
85
84
|
});
|
|
86
85
|
}, _SpoListWebhookGetCommand_initOptions = function _SpoListWebhookGetCommand_initOptions() {
|
|
@@ -93,7 +92,7 @@ _SpoListWebhookGetCommand_instances = new WeakSet(), _SpoListWebhookGetCommand_i
|
|
|
93
92
|
}, {
|
|
94
93
|
option: '--listUrl [listUrl]'
|
|
95
94
|
}, {
|
|
96
|
-
option: '-i, --id
|
|
95
|
+
option: '-i, --id <id>'
|
|
97
96
|
});
|
|
98
97
|
}, _SpoListWebhookGetCommand_initValidators = function _SpoListWebhookGetCommand_initValidators() {
|
|
99
98
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -0,0 +1,239 @@
|
|
|
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 _SpoListItemRoleAssignmentAddCommand_instances, _SpoListItemRoleAssignmentAddCommand_initTelemetry, _SpoListItemRoleAssignmentAddCommand_initOptions, _SpoListItemRoleAssignmentAddCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
20
|
+
const commands_1 = require("../../commands");
|
|
21
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
22
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
23
|
+
const SpoRoleDefinitionListCommand = require("../roledefinition/roledefinition-list");
|
|
24
|
+
const validation_1 = require("../../../../utils/validation");
|
|
25
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
26
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
27
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
28
|
+
class SpoListItemRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
_SpoListItemRoleAssignmentAddCommand_instances.add(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoListItemRoleAssignmentAddCommand_instances, "m", _SpoListItemRoleAssignmentAddCommand_initTelemetry).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoListItemRoleAssignmentAddCommand_instances, "m", _SpoListItemRoleAssignmentAddCommand_initOptions).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoListItemRoleAssignmentAddCommand_instances, "m", _SpoListItemRoleAssignmentAddCommand_initValidators).call(this);
|
|
35
|
+
}
|
|
36
|
+
get name() {
|
|
37
|
+
return commands_1.default.LISTITEM_ROLEASSIGNMENT_ADD;
|
|
38
|
+
}
|
|
39
|
+
get description() {
|
|
40
|
+
return 'Adds a role assignment to a listitem.';
|
|
41
|
+
}
|
|
42
|
+
commandAction(logger, args) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
logger.logToStderr(`Adding role assignment to listitem in site at ${args.options.webUrl}...`);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
49
|
+
if (args.options.listId) {
|
|
50
|
+
requestUrl += `lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
51
|
+
}
|
|
52
|
+
else if (args.options.listTitle) {
|
|
53
|
+
requestUrl += `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
54
|
+
}
|
|
55
|
+
else if (args.options.listUrl) {
|
|
56
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
57
|
+
requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
58
|
+
}
|
|
59
|
+
requestUrl += `items(${args.options.listItemId})/`;
|
|
60
|
+
const roleDefinitionId = yield this.getRoleDefinitionId(args.options);
|
|
61
|
+
let principalId = 0;
|
|
62
|
+
if (args.options.upn) {
|
|
63
|
+
principalId = yield this.getUserPrincipalId(args.options);
|
|
64
|
+
yield this.addRoleAssignment(requestUrl, roleDefinitionId, principalId);
|
|
65
|
+
}
|
|
66
|
+
else if (args.options.groupName) {
|
|
67
|
+
principalId = yield this.getGroupPrincipalId(args.options);
|
|
68
|
+
yield this.addRoleAssignment(requestUrl, roleDefinitionId, principalId);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
principalId = args.options.principalId;
|
|
72
|
+
yield this.addRoleAssignment(requestUrl, roleDefinitionId, principalId);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
this.handleRejectedODataJsonPromise(err);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
addRoleAssignment(requestUrl, roleDefinitionId, principalId) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
try {
|
|
83
|
+
const requestOptions = {
|
|
84
|
+
url: `${requestUrl}roleassignments/addroleassignment(principalid='${principalId}',roledefid='${roleDefinitionId}')`,
|
|
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
|
+
catch (err) {
|
|
95
|
+
return Promise.reject(err);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
getRoleDefinitionId(options) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
if (!options.roleDefinitionName) {
|
|
102
|
+
return options.roleDefinitionId;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const roleDefinitionListCommandOptions = {
|
|
106
|
+
webUrl: options.webUrl,
|
|
107
|
+
output: 'json',
|
|
108
|
+
debug: this.debug,
|
|
109
|
+
verbose: this.verbose
|
|
110
|
+
};
|
|
111
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoRoleDefinitionListCommand, { options: Object.assign(Object.assign({}, roleDefinitionListCommandOptions), { _: [] }) });
|
|
112
|
+
const getRoleDefinitionListOutput = JSON.parse(output.stdout);
|
|
113
|
+
const roleDefinitionId = getRoleDefinitionListOutput.find((role) => role.Name === options.roleDefinitionName).Id;
|
|
114
|
+
return roleDefinitionId;
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
return Promise.reject(err);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getGroupPrincipalId(options) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
try {
|
|
124
|
+
const groupGetCommandOptions = {
|
|
125
|
+
webUrl: options.webUrl,
|
|
126
|
+
name: options.groupName,
|
|
127
|
+
output: 'json',
|
|
128
|
+
debug: this.debug,
|
|
129
|
+
verbose: this.verbose
|
|
130
|
+
};
|
|
131
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
|
|
132
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
133
|
+
return getGroupOutput.Id;
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
return Promise.reject(err);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
getUserPrincipalId(options) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
try {
|
|
143
|
+
const userGetCommandOptions = {
|
|
144
|
+
webUrl: options.webUrl,
|
|
145
|
+
email: options.upn,
|
|
146
|
+
id: undefined,
|
|
147
|
+
output: 'json',
|
|
148
|
+
debug: this.debug,
|
|
149
|
+
verbose: this.verbose
|
|
150
|
+
};
|
|
151
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
|
|
152
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
153
|
+
return getUserOutput.Id;
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
return Promise.reject(err);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
_SpoListItemRoleAssignmentAddCommand_instances = new WeakSet(), _SpoListItemRoleAssignmentAddCommand_initTelemetry = function _SpoListItemRoleAssignmentAddCommand_initTelemetry() {
|
|
162
|
+
this.telemetry.push((args) => {
|
|
163
|
+
Object.assign(this.telemetryProperties, {
|
|
164
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
165
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
166
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
167
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
168
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
169
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
170
|
+
roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
|
|
171
|
+
roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined'
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}, _SpoListItemRoleAssignmentAddCommand_initOptions = function _SpoListItemRoleAssignmentAddCommand_initOptions() {
|
|
175
|
+
this.options.unshift({
|
|
176
|
+
option: '-u, --webUrl <webUrl>'
|
|
177
|
+
}, {
|
|
178
|
+
option: '--listItemId <listItemId>'
|
|
179
|
+
}, {
|
|
180
|
+
option: '--listId [listId]'
|
|
181
|
+
}, {
|
|
182
|
+
option: '--listTitle [listTitle]'
|
|
183
|
+
}, {
|
|
184
|
+
option: '--listUrl [listUrl]'
|
|
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
|
+
}, _SpoListItemRoleAssignmentAddCommand_initValidators = function _SpoListItemRoleAssignmentAddCommand_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.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
|
|
203
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
204
|
+
}
|
|
205
|
+
if (args.options.listItemId && isNaN(args.options.listItemId)) {
|
|
206
|
+
return `Specified listItemId ${args.options.listItemId} is not a number`;
|
|
207
|
+
}
|
|
208
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
209
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
210
|
+
}
|
|
211
|
+
if (args.options.roleDefinitionId && isNaN(args.options.roleDefinitionId)) {
|
|
212
|
+
return `Specified roleDefinitionId ${args.options.roleDefinitionId} is not a number`;
|
|
213
|
+
}
|
|
214
|
+
const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
|
|
215
|
+
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
216
|
+
return `Specify either list id or title or list url`;
|
|
217
|
+
}
|
|
218
|
+
if (listOptions.filter(item => item !== undefined).length === 0) {
|
|
219
|
+
return `Specify at least list id or title or list url`;
|
|
220
|
+
}
|
|
221
|
+
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
222
|
+
if (!principalOptions.some(item => item !== undefined)) {
|
|
223
|
+
return `Specify either principalId, upn or groupName`;
|
|
224
|
+
}
|
|
225
|
+
if (principalOptions.filter(item => item !== undefined).length > 1) {
|
|
226
|
+
return `Specify either principalId, upn or groupName but not multiple`;
|
|
227
|
+
}
|
|
228
|
+
const roleDefinitionOptions = [args.options.roleDefinitionId, args.options.roleDefinitionName];
|
|
229
|
+
if (!roleDefinitionOptions.some(item => item !== undefined)) {
|
|
230
|
+
return `Specify either roleDefinitionId or roleDefinitionName`;
|
|
231
|
+
}
|
|
232
|
+
if (roleDefinitionOptions.filter(item => item !== undefined).length > 1) {
|
|
233
|
+
return `Specify either roleDefinitionId or roleDefinitionName but not multiple`;
|
|
234
|
+
}
|
|
235
|
+
return true;
|
|
236
|
+
}));
|
|
237
|
+
};
|
|
238
|
+
module.exports = new SpoListItemRoleAssignmentAddCommand();
|
|
239
|
+
//# sourceMappingURL=listitem-roleassignment-add.js.map
|
|
@@ -137,6 +137,7 @@ exports.default = {
|
|
|
137
137
|
LISTITEM_RECORD_DECLARE: `${prefix} listitem record declare`,
|
|
138
138
|
LISTITEM_RECORD_UNDECLARE: `${prefix} listitem record undeclare`,
|
|
139
139
|
LISTITEM_REMOVE: `${prefix} listitem remove`,
|
|
140
|
+
LISTITEM_ROLEASSIGNMENT_ADD: `${prefix} listitem roleassignment add`,
|
|
140
141
|
LISTITEM_ROLEASSIGNMENT_REMOVE: `${prefix} listitem roleassignment remove`,
|
|
141
142
|
LISTITEM_ROLEINHERITANCE_BREAK: `${prefix} listitem roleinheritance break`,
|
|
142
143
|
LISTITEM_ROLEINHERITANCE_RESET: `${prefix} listitem roleinheritance reset`,
|