@pnp/cli-microsoft365 5.3.0-beta.c04ad6e → 5.3.0-beta.e5dcef6

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.
Files changed (82) hide show
  1. package/.eslintrc.js +1 -0
  2. package/dist/m365/aad/commands/app/app-add.js +91 -35
  3. package/dist/m365/aad/commands/app/app-role-list.js +1 -1
  4. package/dist/m365/aad/commands/app/app-set.js +91 -0
  5. package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +55 -22
  6. package/dist/m365/aad/commands/group/group-list.js +1 -1
  7. package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +1 -1
  8. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +1 -1
  9. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +1 -1
  10. package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +1 -1
  11. package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +1 -1
  12. package/dist/m365/aad/commands/o365group/o365group-list.js +1 -1
  13. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +3 -3
  14. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +1 -1
  15. package/dist/m365/aad/commands/o365group/o365group-user-list.js +2 -2
  16. package/dist/m365/aad/commands/o365group/o365group-user-set.js +2 -2
  17. package/dist/m365/aad/commands/user/user-list.js +1 -1
  18. package/dist/m365/aad/commands/user/user-signin-list.js +1 -1
  19. package/dist/m365/aad/commands.js +1 -1
  20. package/dist/m365/app/commands/app-open.js +64 -0
  21. package/dist/m365/app/commands.js +1 -0
  22. package/dist/m365/file/commands/file-list.js +1 -1
  23. package/dist/m365/outlook/commands/message/message-list.js +1 -1
  24. package/dist/m365/outlook/commands/room/room-list.js +1 -1
  25. package/dist/m365/outlook/commands/roomlist/roomlist-list.js +1 -1
  26. package/dist/m365/planner/commands/bucket/bucket-add.js +8 -16
  27. package/dist/m365/planner/commands/bucket/bucket-get.js +186 -0
  28. package/dist/m365/planner/commands/bucket/bucket-list.js +10 -19
  29. package/dist/m365/planner/commands/bucket/bucket-remove.js +8 -20
  30. package/dist/m365/planner/commands/bucket/bucket-set.js +9 -21
  31. package/dist/m365/planner/commands/plan/plan-add.js +6 -1
  32. package/dist/m365/planner/commands/plan/plan-details-get.js +12 -15
  33. package/dist/m365/planner/commands/plan/plan-get.js +13 -18
  34. package/dist/m365/planner/commands/plan/plan-list.js +10 -13
  35. package/dist/m365/planner/commands/task/task-add.js +8 -16
  36. package/dist/m365/planner/commands/task/task-details-get.js +6 -0
  37. package/dist/m365/planner/commands/task/task-get.js +11 -23
  38. package/dist/m365/planner/commands/task/task-list.js +15 -24
  39. package/dist/m365/planner/commands/task/task-set.js +9 -18
  40. package/dist/m365/planner/commands.js +1 -0
  41. package/dist/m365/pp/commands/managementapp/managementapp-list.js +1 -1
  42. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +84 -0
  43. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +76 -0
  44. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +83 -0
  45. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +79 -0
  46. package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +49 -0
  47. package/dist/m365/spo/commands.js +5 -0
  48. package/dist/m365/teams/commands/app/app-list.js +1 -1
  49. package/dist/m365/teams/commands/channel/channel-list.js +1 -1
  50. package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
  51. package/dist/m365/teams/commands/chat/chat-get.js +8 -8
  52. package/dist/m365/teams/commands/chat/chat-list.js +1 -1
  53. package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
  54. package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
  55. package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
  56. package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
  57. package/dist/m365/teams/commands/message/message-list.js +1 -1
  58. package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
  59. package/dist/m365/teams/commands/tab/tab-list.js +1 -1
  60. package/dist/m365/teams/commands/team/team-list.js +1 -1
  61. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  62. package/dist/m365/teams/commands/user/user-list.js +2 -2
  63. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
  64. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
  65. package/dist/m365/todo/commands/list/list-list.js +1 -1
  66. package/dist/m365/todo/commands/task/task-list.js +1 -1
  67. package/dist/utils/accessToken.js +18 -0
  68. package/dist/utils/odata.js +2 -2
  69. package/dist/utils/planner.js +65 -0
  70. package/docs/docs/cmd/aad/app/app-add.md +15 -0
  71. package/docs/docs/cmd/aad/app/app-set.md +17 -0
  72. package/docs/docs/cmd/app/app-open.md +45 -0
  73. package/docs/docs/cmd/planner/bucket/bucket-get.md +57 -0
  74. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +55 -0
  75. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +36 -0
  76. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +58 -0
  77. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +39 -0
  78. package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +24 -0
  79. package/docs/docs/cmd/teams/channel/channel-member-list.md +4 -4
  80. package/docs/docs/cmd/teams/channel/channel-member-remove.md +2 -2
  81. package/docs/docs/cmd/teams/channel/channel-member-set.md +2 -2
  82. package/package.json +1 -1
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
5
+ const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
7
9
  class PlannerPlanListCommand extends GraphCommand_1.default {
@@ -21,21 +23,16 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
21
23
  return ['id', 'title', 'createdDateTime', 'owner'];
22
24
  }
23
25
  commandAction(logger, args, cb) {
26
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
27
+ this.handleError('This command does not support application permissions.', logger, cb);
28
+ return;
29
+ }
24
30
  this
25
31
  .getGroupId(args)
26
- .then((groupId) => {
27
- const requestOptions = {
28
- url: `${this.resource}/v1.0/groups/${groupId}/planner/plans`,
29
- headers: {
30
- 'accept': 'application/json;odata.metadata=none'
31
- },
32
- responseType: 'json'
33
- };
34
- return request_1.default.get(requestOptions);
35
- })
32
+ .then((groupId) => planner_1.planner.getPlansByGroupId(groupId))
36
33
  .then((res) => {
37
- if (res.value && res.value.length > 0) {
38
- logger.log(res.value);
34
+ if (res && res.length > 0) {
35
+ logger.log(res);
39
36
  }
40
37
  cb();
41
38
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Auth_1 = require("../../../../Auth");
3
4
  const request_1 = require("../../../../request");
5
+ const planner_1 = require("../../../../utils/planner");
4
6
  const utils_1 = require("../../../../utils");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
@@ -29,6 +31,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
29
31
  return telemetryProps;
30
32
  }
31
33
  commandAction(logger, args, cb) {
34
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
35
+ this.handleError('This command does not support application permissions.', logger, cb);
36
+ return;
37
+ }
32
38
  this
33
39
  .getPlanId(args)
34
40
  .then(planId => {
@@ -151,22 +157,8 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
151
157
  }
152
158
  return this
153
159
  .getGroupId(args)
154
- .then((groupId) => {
155
- const requestOptions = {
156
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
157
- headers: {
158
- accept: 'application/json;odata.metadata=none'
159
- },
160
- responseType: 'json'
161
- };
162
- return request_1.default.get(requestOptions);
163
- }).then((response) => {
164
- const plan = response.value.find(val => val.title === args.options.planName);
165
- if (!plan) {
166
- return Promise.reject(`The specified plan does not exist`);
167
- }
168
- return Promise.resolve(plan.id);
169
- });
160
+ .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
161
+ .then(plan => plan.id);
170
162
  }
171
163
  getGroupId(args) {
172
164
  if (args.options.ownerGroupId) {
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
3
5
  const request_1 = require("../../../../request");
4
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
7
  const commands_1 = require("../../commands");
@@ -11,6 +13,10 @@ class PlannerTaskDetailsGetCommand extends GraphCommand_1.default {
11
13
  return 'Retrieve the details of the specified planner task';
12
14
  }
13
15
  commandAction(logger, args, cb) {
16
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
17
+ this.handleError('This command does not support application permissions.', logger, cb);
18
+ return;
19
+ }
14
20
  const requestOptions = {
15
21
  url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
16
22
  headers: {
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const request_1 = require("../../../../request");
5
+ const utils_2 = require("../../../../utils");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
9
+ const Auth_1 = require("../../../../Auth");
7
10
  class PlannerTaskGetCommand extends GraphCommand_1.default {
8
11
  get name() {
9
12
  return commands_1.default.TASK_GET;
@@ -12,6 +15,10 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
12
15
  return 'Retrieve the the specified planner task';
13
16
  }
14
17
  commandAction(logger, args, cb) {
18
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
19
+ this.handleError('This command does not support application permissions.', logger, cb);
20
+ return;
21
+ }
15
22
  this
16
23
  .getTaskId(args.options)
17
24
  .then(taskId => {
@@ -91,27 +98,8 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
91
98
  }
92
99
  return this
93
100
  .getGroupId(options)
94
- .then((groupId) => {
95
- const requestOptions = {
96
- url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'&$select=id,title`,
97
- headers: {
98
- accept: 'application/json;odata.metadata=none'
99
- },
100
- responseType: 'json'
101
- };
102
- return request_1.default.get(requestOptions);
103
- })
104
- .then((response) => {
105
- const planName = options.planName;
106
- const plans = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === planName.toLocaleLowerCase(); });
107
- if (!plans.length) {
108
- return Promise.reject(`The specified plan ${options.planName} does not exist`);
109
- }
110
- if (plans.length > 1) {
111
- return Promise.reject(`Multiple plans with name ${options.planName} found: ${plans.map(x => x.id)}`);
112
- }
113
- return Promise.resolve(plans[0].id);
114
- });
101
+ .then(groupId => planner_1.planner.getPlanByName(options.planName, groupId))
102
+ .then(plan => plan.id);
115
103
  }
116
104
  getGroupId(options) {
117
105
  if (options.ownerGroupId) {
@@ -170,7 +158,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
170
158
  if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
171
159
  return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
172
160
  }
173
- if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
161
+ if (args.options.ownerGroupId && !utils_2.validation.isValidGuid(args.options.ownerGroupId)) {
174
162
  return `${args.options.ownerGroupId} is not a valid GUID`;
175
163
  }
176
164
  return true;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
5
+ const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
7
9
  class PlannerTaskListCommand extends GraphCommand_1.default {
@@ -25,6 +27,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
25
27
  return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
26
28
  }
27
29
  commandAction(logger, args, cb) {
30
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
31
+ this.handleError('This command does not support application permissions.', logger, cb);
32
+ return;
33
+ }
28
34
  const bucketName = args.options.bucketName;
29
35
  let bucketId = args.options.bucketId;
30
36
  const planName = args.options.planName;
@@ -35,11 +41,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
35
41
  .getBucketId(args)
36
42
  .then((retrievedBucketId) => {
37
43
  bucketId = retrievedBucketId;
38
- return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`, logger);
44
+ return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`);
39
45
  })
40
46
  .then((tasks) => {
41
47
  taskItems = tasks;
42
- return utils_1.odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`, logger);
48
+ return utils_1.odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`);
43
49
  })
44
50
  .then((betaTasks) => {
45
51
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -51,11 +57,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
51
57
  .getPlanId(args)
52
58
  .then((retrievedPlanId) => {
53
59
  planId = retrievedPlanId;
54
- return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`, logger);
60
+ return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`);
55
61
  })
56
62
  .then((tasks) => {
57
63
  taskItems = tasks;
58
- return utils_1.odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`, logger);
64
+ return utils_1.odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`);
59
65
  })
60
66
  .then((betaTasks) => {
61
67
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -64,10 +70,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
64
70
  }
65
71
  else {
66
72
  utils_1.odata
67
- .getAllItems(`${this.resource}/v1.0/me/planner/tasks`, logger)
73
+ .getAllItems(`${this.resource}/v1.0/me/planner/tasks`)
68
74
  .then((tasks) => {
69
75
  taskItems = tasks;
70
- return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`, logger);
76
+ return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`);
71
77
  })
72
78
  .then((betaTasks) => {
73
79
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -105,23 +111,8 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
105
111
  }
106
112
  return this
107
113
  .getGroupId(args)
108
- .then((groupId) => {
109
- const requestOptions = {
110
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
111
- headers: {
112
- accept: 'application/json;odata.metadata=none'
113
- },
114
- responseType: 'json'
115
- };
116
- return request_1.default.get(requestOptions);
117
- })
118
- .then(response => {
119
- const plan = response.value.find(val => val.title === args.options.planName);
120
- if (!plan) {
121
- return Promise.reject(`The specified plan does not exist`);
122
- }
123
- return Promise.resolve(plan.id);
124
- });
114
+ .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
115
+ .then(plan => plan.id);
125
116
  }
126
117
  getGroupId(args) {
127
118
  if (args.options.ownerGroupId) {
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
5
+ const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
7
9
  class PlannerTaskSetCommand extends GraphCommand_1.default {
@@ -36,6 +38,10 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
36
38
  return telemetryProps;
37
39
  }
38
40
  commandAction(logger, args, cb) {
41
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
42
+ this.handleError('This command does not support application permissions.', logger, cb);
43
+ return;
44
+ }
39
45
  this
40
46
  .getBucketId(args.options)
41
47
  .then(bucketId => {
@@ -217,23 +223,8 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
217
223
  }
218
224
  return this
219
225
  .getGroupId(options)
220
- .then((groupId) => {
221
- const requestOptions = {
222
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')&$select=id,title`,
223
- headers: {
224
- accept: 'application/json;odata.metadata=none'
225
- },
226
- responseType: 'json'
227
- };
228
- return request_1.default.get(requestOptions);
229
- })
230
- .then((response) => {
231
- const plan = response.value.find(val => val.title === options.planName);
232
- if (!plan) {
233
- return Promise.reject(`The specified plan does not exist`);
234
- }
235
- return Promise.resolve(plan.id);
236
- });
226
+ .then((groupId) => planner_1.planner.getPlanByName(options.planName, groupId))
227
+ .then(plan => plan.id);
237
228
  }
238
229
  getGroupId(options) {
239
230
  if (options.ownerGroupId) {
@@ -6,6 +6,7 @@ exports.default = {
6
6
  BUCKET_LIST: `${prefix} bucket list`,
7
7
  BUCKET_SET: `${prefix} bucket set`,
8
8
  BUCKET_REMOVE: `${prefix} bucket remove`,
9
+ BUCKET_GET: `${prefix} bucket get`,
9
10
  PLAN_ADD: `${prefix} plan add`,
10
11
  PLAN_GET: `${prefix} plan get`,
11
12
  PLAN_DETAILS_GET: `${prefix} plan details get`,
@@ -13,7 +13,7 @@ class PpManagementAppListCommand extends PowerPlatformCommand_1.default {
13
13
  commandAction(logger, args, cb) {
14
14
  const endpoint = `${this.resource}/providers/Microsoft.BusinessAppPlatform/adminApplications?api-version=2020-06-01`;
15
15
  utils_1.odata
16
- .getAllItems(endpoint, logger)
16
+ .getAllItems(endpoint)
17
17
  .then((managementApps) => {
18
18
  logger.log(managementApps);
19
19
  cb();
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListRoleInheritanceBreakCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LIST_ROLEINHERITANCE_BREAK;
10
+ }
11
+ get description() {
12
+ return 'Breaks role inheritance on list or library';
13
+ }
14
+ optionSets() {
15
+ return [
16
+ ['listId', 'listTitle']
17
+ ];
18
+ }
19
+ getTelemetryProperties(args) {
20
+ const telemetryProps = super.getTelemetryProperties(args);
21
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
22
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
23
+ telemetryProps.clearExistingPermissions = args.options.clearExistingPermissions === true;
24
+ return telemetryProps;
25
+ }
26
+ commandAction(logger, args, cb) {
27
+ if (this.verbose) {
28
+ logger.logToStderr(`Breaking role inheritance of list in site at ${args.options.webUrl}...`);
29
+ }
30
+ let requestUrl = `${args.options.webUrl}/_api/web/lists`;
31
+ if (args.options.listId) {
32
+ requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
33
+ }
34
+ else {
35
+ requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
36
+ }
37
+ let keepExistingPermissions = true;
38
+ if (args.options.clearExistingPermissions) {
39
+ keepExistingPermissions = !args.options.clearExistingPermissions;
40
+ }
41
+ const requestOptions = {
42
+ url: `${requestUrl}/breakroleinheritance(${keepExistingPermissions})`,
43
+ method: 'POST',
44
+ headers: {
45
+ 'accept': 'application/json;odata=nometadata',
46
+ 'content-type': 'application/json'
47
+ },
48
+ responseType: 'json'
49
+ };
50
+ request_1.default
51
+ .post(requestOptions)
52
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
53
+ }
54
+ options() {
55
+ const options = [
56
+ {
57
+ option: '-u, --webUrl <webUrl>'
58
+ },
59
+ {
60
+ option: '-i, --listId [listId]'
61
+ },
62
+ {
63
+ option: '-t, --listTitle [listTitle]'
64
+ },
65
+ {
66
+ option: '-c, --clearExistingPermissions'
67
+ }
68
+ ];
69
+ const parentOptions = super.options();
70
+ return options.concat(parentOptions);
71
+ }
72
+ validate(args) {
73
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
74
+ if (isValidSharePointUrl !== true) {
75
+ return isValidSharePointUrl;
76
+ }
77
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
78
+ return `${args.options.listId} is not a valid GUID`;
79
+ }
80
+ return true;
81
+ }
82
+ }
83
+ module.exports = new SpoListRoleInheritanceBreakCommand();
84
+ //# sourceMappingURL=list-roleinheritance-break.js.map
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListRoleInheritanceResetCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LIST_ROLEINHERITANCE_RESET;
10
+ }
11
+ get description() {
12
+ return 'Restores role inheritance on list or library';
13
+ }
14
+ optionSets() {
15
+ return [
16
+ ['listId', 'listTitle']
17
+ ];
18
+ }
19
+ getTelemetryProperties(args) {
20
+ const telemetryProps = super.getTelemetryProperties(args);
21
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
22
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
23
+ return telemetryProps;
24
+ }
25
+ commandAction(logger, args, cb) {
26
+ if (this.verbose) {
27
+ logger.logToStderr(`Restore role inheritance of list in site at ${args.options.webUrl}...`);
28
+ }
29
+ let requestUrl = `${args.options.webUrl}/_api/web/lists`;
30
+ if (args.options.listId) {
31
+ requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
32
+ }
33
+ else {
34
+ requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
35
+ }
36
+ const requestOptions = {
37
+ url: `${requestUrl}/resetroleinheritance`,
38
+ method: 'POST',
39
+ headers: {
40
+ 'accept': 'application/json;odata=nometadata',
41
+ 'content-type': 'application/json'
42
+ },
43
+ responseType: 'json'
44
+ };
45
+ request_1.default
46
+ .post(requestOptions)
47
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
48
+ }
49
+ options() {
50
+ const options = [
51
+ {
52
+ option: '-u, --webUrl <webUrl>'
53
+ },
54
+ {
55
+ option: '-i, --listId [listId]'
56
+ },
57
+ {
58
+ option: '-t, --listTitle [listTitle]'
59
+ }
60
+ ];
61
+ const parentOptions = super.options();
62
+ return options.concat(parentOptions);
63
+ }
64
+ validate(args) {
65
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
66
+ if (isValidSharePointUrl !== true) {
67
+ return isValidSharePointUrl;
68
+ }
69
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
70
+ return `${args.options.listId} is not a valid GUID`;
71
+ }
72
+ return true;
73
+ }
74
+ }
75
+ module.exports = new SpoListRoleInheritanceResetCommand();
76
+ //# sourceMappingURL=list-roleinheritance-reset.js.map
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListItemRoleInheritanceBreakCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LISTITEM_ROLEINHERITANCE_BREAK;
10
+ }
11
+ get description() {
12
+ return 'Break inheritance of list item';
13
+ }
14
+ optionSets() {
15
+ return [
16
+ ['listId', 'listTitle']
17
+ ];
18
+ }
19
+ commandAction(logger, args, cb) {
20
+ if (this.verbose) {
21
+ logger.logToStderr(`Breaking role inheritance of list item in site at ${args.options.webUrl}...`);
22
+ }
23
+ let requestUrl = `${args.options.webUrl}/_api/web/lists`;
24
+ if (args.options.listId) {
25
+ requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
26
+ }
27
+ else {
28
+ requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
29
+ }
30
+ let keepExistingPermissions = true;
31
+ if (args.options.clearExistingPermissions) {
32
+ keepExistingPermissions = !args.options.clearExistingPermissions;
33
+ }
34
+ const requestOptions = {
35
+ url: `${requestUrl}/items(${args.options.listItemId})/breakroleinheritance(${keepExistingPermissions})`,
36
+ method: 'POST',
37
+ headers: {
38
+ 'accept': 'application/json;odata=nometadata',
39
+ 'content-type': 'application/json'
40
+ },
41
+ responseType: 'json'
42
+ };
43
+ request_1.default
44
+ .post(requestOptions)
45
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
46
+ }
47
+ options() {
48
+ const options = [
49
+ {
50
+ option: '-u, --webUrl <webUrl>'
51
+ },
52
+ {
53
+ option: '--listItemId <listItemId>'
54
+ },
55
+ {
56
+ option: '-l, --listId [listId]'
57
+ },
58
+ {
59
+ option: '-t, --listTitle [listTitle]'
60
+ },
61
+ {
62
+ option: '-c, --clearExistingPermissions'
63
+ }
64
+ ];
65
+ const parentOptions = super.options();
66
+ return options.concat(parentOptions);
67
+ }
68
+ validate(args) {
69
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
70
+ if (isValidSharePointUrl !== true) {
71
+ return isValidSharePointUrl;
72
+ }
73
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
74
+ return `${args.options.listId} is not a valid GUID`;
75
+ }
76
+ if (isNaN(args.options.listItemId)) {
77
+ return `${args.options.listItemId} is not a number`;
78
+ }
79
+ return true;
80
+ }
81
+ }
82
+ module.exports = new SpoListItemRoleInheritanceBreakCommand();
83
+ //# sourceMappingURL=listitem-roleinheritance-break.js.map
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListItemRoleInheritanceResetCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LISTITEM_ROLEINHERITANCE_RESET;
10
+ }
11
+ get description() {
12
+ return 'Restores the role inheritance of list item, file, or folder';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
17
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
18
+ return telemetryProps;
19
+ }
20
+ commandAction(logger, args, cb) {
21
+ let requestUrl = `${args.options.webUrl}/_api/web/lists`;
22
+ if (args.options.listId) {
23
+ requestUrl += `(guid'${encodeURIComponent(args.options.listId)}')`;
24
+ }
25
+ else {
26
+ requestUrl += `/getbytitle('${encodeURIComponent(args.options.listTitle)}')`;
27
+ }
28
+ const requestOptions = {
29
+ url: `${requestUrl}/items(${args.options.listItemId})/resetroleinheritance`,
30
+ method: 'POST',
31
+ headers: {
32
+ 'accept': 'application/json;odata=nometadata',
33
+ 'content-type': 'application/json'
34
+ },
35
+ responseType: 'json'
36
+ };
37
+ request_1.default
38
+ .post(requestOptions)
39
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
40
+ }
41
+ optionSets() {
42
+ return [
43
+ ['listId', 'listTitle']
44
+ ];
45
+ }
46
+ options() {
47
+ const options = [
48
+ {
49
+ option: '-u, --webUrl <webUrl>'
50
+ },
51
+ {
52
+ option: '--listItemId <listItemId>'
53
+ },
54
+ {
55
+ option: '--listId [listId]'
56
+ },
57
+ {
58
+ option: '--listTitle [listTitle]'
59
+ }
60
+ ];
61
+ const parentOptions = super.options();
62
+ return options.concat(parentOptions);
63
+ }
64
+ validate(args) {
65
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
66
+ if (isValidSharePointUrl !== true) {
67
+ return isValidSharePointUrl;
68
+ }
69
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
70
+ return `${args.options.listId} is not a valid GUID`;
71
+ }
72
+ if (isNaN(args.options.listItemId)) {
73
+ return `${args.options.listItemId} is not a number`;
74
+ }
75
+ return true;
76
+ }
77
+ }
78
+ module.exports = new SpoListItemRoleInheritanceResetCommand();
79
+ //# sourceMappingURL=listitem-roleinheritance-reset.js.map