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

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 CHANGED
@@ -29,6 +29,7 @@ const dictionary = [
29
29
  'home',
30
30
  'hub',
31
31
  'in',
32
+ 'inheritance',
32
33
  'init',
33
34
  'install',
34
35
  'installed',
@@ -22,29 +22,14 @@ class AadAppRoleAssignmentListCommand extends GraphCommand_1.default {
22
22
  return ['resourceDisplayName', 'roleName'];
23
23
  }
24
24
  commandAction(logger, args, cb) {
25
- let sp;
26
- // get the service principal associated with the appId
27
- let spMatchQuery = '';
28
- if (args.options.appId) {
29
- spMatchQuery = `appId eq '${encodeURIComponent(args.options.appId)}'`;
30
- }
31
- else if (args.options.objectId) {
32
- spMatchQuery = `id eq '${encodeURIComponent(args.options.objectId)}'`;
33
- }
34
- else {
35
- spMatchQuery = `displayName eq '${encodeURIComponent(args.options.displayName)}'`;
36
- }
37
- this
38
- .getServicePrincipalForApp(spMatchQuery)
39
- .then((resp) => {
40
- if (!resp.value.length) {
41
- return Promise.reject('app registration not found');
42
- }
43
- sp = resp.value[0];
25
+ let spAppRoleAssignments;
26
+ this.getAppRoleAssignments(args.options)
27
+ .then((appRoleAssignments) => {
28
+ spAppRoleAssignments = appRoleAssignments;
44
29
  // the role assignment has an appRoleId but no name. To get the name,
45
30
  // we need to get all the roles from the resource. the resource is
46
31
  // a service principal. Multiple roles may have same resource id.
47
- const resourceIds = sp.appRoleAssignments.map((item) => item.resourceId);
32
+ const resourceIds = appRoleAssignments.map((item) => item.resourceId);
48
33
  const tasks = [];
49
34
  for (let i = 0; i < resourceIds.length; i++) {
50
35
  tasks.push(this.getServicePrincipal(resourceIds[i]));
@@ -55,7 +40,7 @@ class AadAppRoleAssignmentListCommand extends GraphCommand_1.default {
55
40
  // loop through all appRoleAssignments for the servicePrincipal
56
41
  // and lookup the appRole.Id in the resources[resourceId].appRoles array...
57
42
  const results = [];
58
- sp.appRoleAssignments.map((appRoleAssignment) => {
43
+ spAppRoleAssignments.map((appRoleAssignment) => {
59
44
  const resource = resources.find((r) => r.id === appRoleAssignment.resourceId);
60
45
  if (resource) {
61
46
  const appRole = resource.appRoles.find((r) => r.id === appRoleAssignment.appRoleId);
@@ -65,7 +50,9 @@ class AadAppRoleAssignmentListCommand extends GraphCommand_1.default {
65
50
  resourceDisplayName: appRoleAssignment.resourceDisplayName,
66
51
  resourceId: appRoleAssignment.resourceId,
67
52
  roleId: appRole.id,
68
- roleName: appRole.value
53
+ roleName: appRole.value,
54
+ created: appRoleAssignment.createdDateTime,
55
+ deleted: appRoleAssignment.deletedDateTime
69
56
  });
70
57
  }
71
58
  }
@@ -74,6 +61,52 @@ class AadAppRoleAssignmentListCommand extends GraphCommand_1.default {
74
61
  cb();
75
62
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
76
63
  }
64
+ getAppRoleAssignments(argOptions) {
65
+ return new Promise((resolve, reject) => {
66
+ if (argOptions.objectId) {
67
+ this.getSPAppRoleAssignments(argOptions.objectId)
68
+ .then((spAppRoleAssignments) => {
69
+ if (!spAppRoleAssignments.value.length) {
70
+ reject('no app role assignments found');
71
+ }
72
+ resolve(spAppRoleAssignments.value);
73
+ })
74
+ .catch((err) => {
75
+ reject(err);
76
+ });
77
+ }
78
+ else {
79
+ // Use existing way to get service principal object
80
+ let spMatchQuery = '';
81
+ if (argOptions.appId) {
82
+ spMatchQuery = `appId eq '${encodeURIComponent(argOptions.appId)}'`;
83
+ }
84
+ else {
85
+ spMatchQuery = `displayName eq '${encodeURIComponent(argOptions.displayName)}'`;
86
+ }
87
+ this.getServicePrincipalForApp(spMatchQuery)
88
+ .then((resp) => {
89
+ if (!resp.value.length) {
90
+ reject('app registration not found');
91
+ }
92
+ resolve(resp.value[0].appRoleAssignments);
93
+ })
94
+ .catch((err) => {
95
+ reject(err);
96
+ });
97
+ }
98
+ });
99
+ }
100
+ getSPAppRoleAssignments(spId) {
101
+ const spRequestOptions = {
102
+ url: `${this.resource}/v1.0/servicePrincipals/${spId}/appRoleAssignments`,
103
+ headers: {
104
+ accept: 'application/json'
105
+ },
106
+ responseType: 'json'
107
+ };
108
+ return request_1.default.get(spRequestOptions);
109
+ }
77
110
  getServicePrincipalForApp(filterParam) {
78
111
  const spRequestOptions = {
79
112
  url: `${this.resource}/v1.0/servicePrincipals?$expand=appRoleAssignments&$filter=${filterParam}`,
@@ -6,11 +6,11 @@ exports.default = {
6
6
  APP_DELETE: `${prefix} app delete`,
7
7
  APP_GET: `${prefix} app get`,
8
8
  APP_REMOVE: `${prefix} app remove`,
9
- APP_SET: `${prefix} app set`,
10
9
  APP_ROLE_ADD: `${prefix} app role add`,
11
10
  APP_ROLE_DELETE: `${prefix} app role delete`,
12
11
  APP_ROLE_LIST: `${prefix} app role list`,
13
12
  APP_ROLE_REMOVE: `${prefix} app role remove`,
13
+ APP_SET: `${prefix} app set`,
14
14
  APPROLEASSIGNMENT_ADD: `${prefix} approleassignment add`,
15
15
  APPROLEASSIGNMENT_LIST: `${prefix} approleassignment list`,
16
16
  APPROLEASSIGNMENT_REMOVE: `${prefix} approleassignment remove`,
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_1 = require("../../../cli");
4
+ const validation_1 = require("../../../utils/validation");
5
+ const settingsNames_1 = require("../../../settingsNames");
6
+ const AppCommand_1 = require("../../base/AppCommand");
7
+ const commands_1 = require("../commands");
8
+ class AppOpenCommand extends AppCommand_1.default {
9
+ get name() {
10
+ return commands_1.default.OPEN;
11
+ }
12
+ get description() {
13
+ return 'Opens Azure AD app in the Azure AD portal';
14
+ }
15
+ getTelemetryProperties(args) {
16
+ const telemetryProps = super.getTelemetryProperties(args);
17
+ telemetryProps.appId = typeof args.options.appId !== 'undefined';
18
+ telemetryProps.preview = typeof args.options.preview !== 'undefined';
19
+ return telemetryProps;
20
+ }
21
+ commandAction(logger, args, cb) {
22
+ this.logOrOpenUrl(args, logger)
23
+ .then(_ => cb(), (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
24
+ }
25
+ logOrOpenUrl(args, logger) {
26
+ return new Promise((resolve, reject) => {
27
+ const previewPrefix = args.options.preview === true ? "preview." : "";
28
+ const url = `https://${previewPrefix}portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/${this.appId}/isMSAApp/`;
29
+ if (cli_1.Cli.getInstance().getSettingWithDefaultValue(settingsNames_1.settingsNames.autoOpenLinksInBrowser, false) === false) {
30
+ logger.log(`Use a web browser to open the page ${url}`);
31
+ return resolve();
32
+ }
33
+ logger.log(`Opening the following page in your browser: ${url}`);
34
+ // 'open' is required here so we can lazy load the dependency.
35
+ // _open is never set before hitting this line, but this check
36
+ // is implemented so that we can stub it when testing.
37
+ /* c8 ignore next 3 */
38
+ if (!this._open) {
39
+ this._open = require('open');
40
+ }
41
+ this._open(url).then(() => {
42
+ resolve();
43
+ }, (error) => {
44
+ reject(error);
45
+ });
46
+ });
47
+ }
48
+ options() {
49
+ const options = [
50
+ { option: '--appId [appId]' },
51
+ { option: '--preview' }
52
+ ];
53
+ const parentOptions = super.options();
54
+ return options.concat(parentOptions);
55
+ }
56
+ validate(args) {
57
+ if (args.options.appId && !validation_1.validation.isValidGuid(args.options.appId)) {
58
+ return `${args.options.appId} is not a valid GUID`;
59
+ }
60
+ return true;
61
+ }
62
+ }
63
+ module.exports = new AppOpenCommand();
64
+ //# sourceMappingURL=app-open.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'app';
4
4
  exports.default = {
5
5
  GET: `${prefix} get`,
6
+ OPEN: `${prefix} open`,
6
7
  PERMISSION_LIST: `${prefix} permission list`
7
8
  };
8
9
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,198 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const request_1 = require("../../../../request");
13
+ const utils_1 = require("../../../../utils");
14
+ const GraphCommand_1 = require("../../../base/GraphCommand");
15
+ const commands_1 = require("../../commands");
16
+ class PlannerBucketGetCommand extends GraphCommand_1.default {
17
+ get name() {
18
+ return commands_1.default.BUCKET_GET;
19
+ }
20
+ get description() {
21
+ return 'Gets the Microsoft Planner bucket in a plan';
22
+ }
23
+ getTelemetryProperties(args) {
24
+ const telemetryProps = super.getTelemetryProperties(args);
25
+ telemetryProps.id = typeof args.options.id !== 'undefined';
26
+ telemetryProps.name = typeof args.options.name !== 'undefined';
27
+ telemetryProps.planId = typeof args.options.planId !== 'undefined';
28
+ telemetryProps.planName = typeof args.options.planName !== 'undefined';
29
+ telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
30
+ telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
31
+ return telemetryProps;
32
+ }
33
+ commandAction(logger, args, cb) {
34
+ this
35
+ .getBucketId(args)
36
+ .then((bucketId) => this.getBucketById(bucketId))
37
+ .then((bucket) => {
38
+ logger.log(bucket);
39
+ cb();
40
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
41
+ }
42
+ getBucketId(args) {
43
+ const { id, name } = args.options;
44
+ if (id) {
45
+ return Promise.resolve(id);
46
+ }
47
+ return this
48
+ .getPlanId(args)
49
+ .then((planId) => {
50
+ const requestOptions = {
51
+ url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
52
+ headers: {
53
+ accept: 'application/json;odata.metadata=none'
54
+ },
55
+ responseType: 'json'
56
+ };
57
+ return request_1.default.get(requestOptions);
58
+ })
59
+ .then(buckets => {
60
+ const filteredBuckets = buckets.value.filter(b => name.toLowerCase() === b.name.toLowerCase());
61
+ if (!filteredBuckets.length) {
62
+ return Promise.reject(`The specified bucket ${name} does not exist`);
63
+ }
64
+ if (filteredBuckets.length > 1) {
65
+ return Promise.reject(`Multiple buckets with name ${name} found: ${filteredBuckets.map(x => x.id)}`);
66
+ }
67
+ return Promise.resolve(filteredBuckets[0].id.toString());
68
+ });
69
+ }
70
+ getPlanId(args) {
71
+ const { planId, planName } = args.options;
72
+ if (planId) {
73
+ return Promise.resolve(planId);
74
+ }
75
+ return this
76
+ .getGroupId(args)
77
+ .then(groupId => {
78
+ const requestOptions = {
79
+ url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'`,
80
+ headers: {
81
+ accept: 'application/json;odata.metadata=none'
82
+ },
83
+ responseType: 'json'
84
+ };
85
+ return request_1.default.get(requestOptions);
86
+ })
87
+ .then(plans => {
88
+ const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
89
+ if (filteredPlans.length === 0) {
90
+ return Promise.reject(`The specified plan ${planName} does not exist`);
91
+ }
92
+ if (filteredPlans.length > 1) {
93
+ return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
94
+ }
95
+ return Promise.resolve(filteredPlans[0].id);
96
+ });
97
+ }
98
+ getBucketById(id) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const requestOptions = {
101
+ url: `${this.resource}/v1.0/planner/buckets/${id}`,
102
+ headers: {
103
+ accept: 'application/json'
104
+ },
105
+ responseType: 'json'
106
+ };
107
+ return request_1.default.get(requestOptions);
108
+ });
109
+ }
110
+ getGroupId(args) {
111
+ const { ownerGroupId, ownerGroupName } = args.options;
112
+ if (ownerGroupId) {
113
+ return Promise.resolve(ownerGroupId);
114
+ }
115
+ const requestOptions = {
116
+ url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(ownerGroupName)}'`,
117
+ headers: {
118
+ accept: 'application/json;odata.metadata=none'
119
+ },
120
+ responseType: 'json'
121
+ };
122
+ return request_1.default
123
+ .get(requestOptions)
124
+ .then(response => {
125
+ if (!response.value.length) {
126
+ return Promise.reject(`The specified owner group ${ownerGroupName} does not exist`);
127
+ }
128
+ if (response.value.length > 1) {
129
+ return Promise.reject(`Multiple owner groups with name ${ownerGroupName} found: ${response.value.map(x => x.id)}`);
130
+ }
131
+ return Promise.resolve(response.value[0].id);
132
+ });
133
+ }
134
+ options() {
135
+ const options = [
136
+ {
137
+ option: '-i, --id [id]'
138
+ },
139
+ {
140
+ option: '--name [name]'
141
+ },
142
+ {
143
+ option: '--planId [planId]'
144
+ },
145
+ {
146
+ option: '--planName [planName]'
147
+ },
148
+ {
149
+ option: '--ownerGroupId [ownerGroupId]'
150
+ },
151
+ {
152
+ option: '--ownerGroupName [ownerGroupName]'
153
+ }
154
+ ];
155
+ const parentOptions = super.options();
156
+ return options.concat(parentOptions);
157
+ }
158
+ validate(args) {
159
+ if (args.options.id) {
160
+ if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
161
+ return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
162
+ }
163
+ if (args.options.name) {
164
+ return 'Specify either id or name';
165
+ }
166
+ }
167
+ if (args.options.name) {
168
+ if (!args.options.planId && !args.options.planName) {
169
+ return 'Specify either planId or planName when using name';
170
+ }
171
+ if (args.options.planId && args.options.planName) {
172
+ return 'Specify either planId or planName when using name but not both';
173
+ }
174
+ if (args.options.planName) {
175
+ if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
176
+ return 'Specify either ownerGroupId or ownerGroupName when using planName';
177
+ }
178
+ if (args.options.ownerGroupId && args.options.ownerGroupName) {
179
+ return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
180
+ }
181
+ if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
182
+ return `${args.options.ownerGroupId} is not a valid GUID`;
183
+ }
184
+ }
185
+ if (args.options.planId) {
186
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
187
+ return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
188
+ }
189
+ }
190
+ }
191
+ if (!args.options.id && !args.options.name) {
192
+ return 'Please specify id or name';
193
+ }
194
+ return true;
195
+ }
196
+ }
197
+ module.exports = new PlannerBucketGetCommand();
198
+ //# sourceMappingURL=bucket-get.js.map
@@ -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`,
@@ -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,49 @@
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 SpoRoleDefinitionListCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.ROLEDEFINITION_LIST;
10
+ }
11
+ get description() {
12
+ return 'Gets list of role definitions for the specified site';
13
+ }
14
+ defaultProperties() {
15
+ return ['Id', 'Name'];
16
+ }
17
+ commandAction(logger, args, cb) {
18
+ if (this.verbose) {
19
+ logger.logToStderr(`Getting role definitions list from ${args.options.webUrl}...`);
20
+ }
21
+ const requestOptions = {
22
+ url: `${args.options.webUrl}/_api/web/roledefinitions`,
23
+ headers: {
24
+ 'accept': 'application/json;odata=nometadata'
25
+ },
26
+ responseType: 'json'
27
+ };
28
+ request_1.default
29
+ .get(requestOptions)
30
+ .then((response) => {
31
+ logger.log(response.value);
32
+ cb();
33
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
34
+ }
35
+ options() {
36
+ const options = [
37
+ {
38
+ option: '-u, --webUrl <webUrl>'
39
+ }
40
+ ];
41
+ const parentOptions = super.options();
42
+ return options.concat(parentOptions);
43
+ }
44
+ validate(args) {
45
+ return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
46
+ }
47
+ }
48
+ module.exports = new SpoRoleDefinitionListCommand();
49
+ //# sourceMappingURL=roledefinition-list.js.map
@@ -96,6 +96,8 @@ exports.default = {
96
96
  LIST_LABEL_SET: `${prefix} list label set`,
97
97
  LIST_LIST: `${prefix} list list`,
98
98
  LIST_REMOVE: `${prefix} list remove`,
99
+ LIST_ROLEINHERITANCE_BREAK: `${prefix} list roleinheritance break`,
100
+ LIST_ROLEINHERITANCE_RESET: `${prefix} list roleinheritance reset`,
99
101
  LIST_SET: `${prefix} list set`,
100
102
  LIST_SITESCRIPT_GET: `${prefix} list sitescript get`,
101
103
  LIST_VIEW_GET: `${prefix} list view get`,
@@ -160,6 +162,7 @@ exports.default = {
160
162
  REPORT_SITEUSAGEPAGES: `${prefix} report siteusagepages`,
161
163
  REPORT_SITEUSAGESITECOUNTS: `${prefix} report siteusagesitecounts`,
162
164
  REPORT_SITEUSAGESTORAGE: `${prefix} report siteusagestorage`,
165
+ ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
163
166
  SEARCH: `${prefix} search`,
164
167
  SERVICEPRINCIPAL_GRANT_ADD: `${prefix} serviceprincipal grant add`,
165
168
  SERVICEPRINCIPAL_GRANT_LIST: `${prefix} serviceprincipal grant list`,
@@ -0,0 +1,45 @@
1
+ # aad app open
2
+
3
+ Returns deep link of the current AD app to open the Azure portal on the Azure AD app registration management page.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 app open [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `--appId [appId]`
14
+ : Optional Application (client) ID of the Azure AD application registration to open. Uses the app from the `.m365rc.json` file corresponding to the `appId`. If multiple apps are available, this will evade the prompt to choose an app. If the `appId` is not available in the list of apps, an error is thrown.
15
+
16
+ `--preview`
17
+ : Use to open the url of the Azure AD preview portal.
18
+
19
+ --8<-- "docs/cmd/_global.md"
20
+
21
+ ## Remarks
22
+
23
+ If config setting `autoOpenLinksInBrowser` is configured to true, the command will automatically open the link to the Azure Portal in the browser.
24
+
25
+ Gets the app from the `.m365rc.json` file in the current directory. If the `--appId` option is not used and multiple apps are available, it will prompt the user to choose one.
26
+
27
+ ## Examples
28
+
29
+ Prints the URL to the Azure AD application registration management page on the Azure Portal.
30
+
31
+ ```sh
32
+ m365 app open
33
+ ```
34
+
35
+ Prints the url of the Azure AD application registration management page on the preview Azure Portal.
36
+
37
+ ```sh
38
+ m365 app open --preview
39
+ ```
40
+
41
+ Prints the URL to the Azure AD application registration management page on the Azure Portal, evading a possible choice prompt in the case of multiple saved apps in the `.m365rc.json` file.
42
+
43
+ ```sh
44
+ m365 app open --appId d75be2e1-0204-4f95-857d-51a37cf40be8
45
+ ```
@@ -0,0 +1,57 @@
1
+ # planner bucket get
2
+
3
+ Gets the Microsoft Planner bucket in a plan
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 planner bucket get [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-i, --id [id]`
14
+ : ID of the bucket to retrieve details. Specify either `id` or `name` but not both.
15
+
16
+ `-name, --name [name]`
17
+ : Name of the bucket to retrieve details. Specify either `id` or `name` but not both.
18
+
19
+ `--planId [planId]`
20
+ : Plan ID to which the bucket belongs. Specify either `planId` or `planName` when using `name`.
21
+
22
+ `--planName [planName]`
23
+ : Plan Name to which the bucket belongs. Specify either `planId` or `planName` when using `name`.
24
+
25
+ `--ownerGroupId [ownerGroupId]`
26
+ : ID of the group to which the plan belongs. Specify `ownerGroupId` or `ownerGroupName` when using `planName`.
27
+
28
+ `--ownerGroupName [ownerGroupName]`
29
+ : Name of the group to which the plan belongs. Specify `ownerGroupId` or `ownerGroupName` when using `planName`.
30
+
31
+ --8<-- "docs/cmd/_global.md"
32
+
33
+ ## Examples
34
+
35
+ Gets the specified Microsoft Planner bucket
36
+
37
+ ```sh
38
+ m365 planner bucket get --id "5h1uuYFk4kKQ0hfoTUkRLpgALtYi"
39
+ ```
40
+
41
+ Gets the Microsoft Planner bucket in the PlanId xqQg5FS2LkCp935s-FIFm2QAFkHM
42
+
43
+ ```sh
44
+ m365 planner bucket get --name "Planner Bucket A" --planId "xqQg5FS2LkCp935s-FIFm2QAFkHM"
45
+ ```
46
+
47
+ Gets the Microsoft Planner bucket in the Plan _My Plan_ owned by group _My Group_
48
+
49
+ ```sh
50
+ m365 planner bucket get --name "Planner Bucket A" --planName "My Plan" --ownerGroupName "My Group"
51
+ ```
52
+
53
+ Gets the Microsoft Planner bucket in the Plan _My Plan_ owned by groupId ee0f40fc-b2f7-45c7-b62d-11b90dd2ea8e
54
+
55
+ ```sh
56
+ m365 planner bucket get --name "Planner Bucket A" --planName "My Plan" --ownerGroupId "ee0f40fc-b2f7-45c7-b62d-11b90dd2ea8e"
57
+ ```
@@ -0,0 +1,55 @@
1
+ # spo list roleinheritance break
2
+
3
+ Breaks role inheritance on list or library
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo list roleinheritance break [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site where the list to retrieve is located
15
+
16
+ `-i, --listId [listId]`
17
+ : ID of the list to retrieve information for. Specify either id or title but not both
18
+
19
+ `-t, --listTitle [listTitle]`
20
+ : Title of the list to retrieve information for. Specify either id or title but not both
21
+
22
+ `-c, --clearExistingPermissions`
23
+ : Flag if used clears all roles from the list
24
+
25
+ --8<-- "docs/cmd/_global.md"
26
+
27
+ ## Remarks
28
+
29
+ By default, when breaking permissions inheritance, the list will retain existing permissions. To remove existing permissions, use the `--clearExistingPermissions` option.
30
+
31
+ ## Examples
32
+
33
+ Break inheritance of list _someList_ located in site _https://contoso.sharepoint.com/sites/project-x_
34
+
35
+ ```sh
36
+ m365 spo list roleinheritance break --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList"
37
+ ```
38
+
39
+ Break inheritance of list with ID _202b8199-b9de-43fd-9737-7f213f51c991_ located in site _https://contoso.sharepoint.com/sites/project-x_
40
+
41
+ ```sh
42
+ m365 spo list roleinheritance break --webUrl "https://contoso.sharepoint.com/sites/project-x" --listId "202b8199-b9de-43fd-9737-7f213f51c991"
43
+ ```
44
+
45
+ Break inheritance of list _someList_ located in site _https://contoso.sharepoint.com/sites/project-x_ with clearing permissions
46
+
47
+ ```sh
48
+ m365 spo list roleinheritance break --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --clearExistingPermissions
49
+ ```
50
+
51
+ Break inheritance of list with ID _202b8199-b9de-43fd-9737-7f213f51c991_ located in site _https://contoso.sharepoint.com/sites/project-x_ with clearing permissions
52
+
53
+ ```sh
54
+ m365 spo list roleinheritance break --webUrl "https://contoso.sharepoint.com/sites/project-x" --listId "202b8199-b9de-43fd-9737-7f213f51c991" --clearExistingPermissions
55
+ ```
@@ -0,0 +1,36 @@
1
+ # spo list roleinheritance reset
2
+
3
+ Restores role inheritance on list or library
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo list roleinheritance reset [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site where the list is located
15
+
16
+ `-i, --listId [listId]`
17
+ : ID of the list. Specify either id or title but not both
18
+
19
+ `-t, --listTitle [listTitle]`
20
+ : Title of the list. Specify either id or title but not both
21
+
22
+ --8<-- "docs/cmd/_global.md"
23
+
24
+ ## Examples
25
+
26
+ Restore role inheritance of list with ID _0cd891ef-afce-4e55-b836-fce03286cccf_ located in site _https://contoso.sharepoint.com/sites/project-x_
27
+
28
+ ```sh
29
+ m365 spo list roleinheritance reset --webUrl https://contoso.sharepoint.com/sites/project-x --listId 0cd891ef-afce-4e55-b836-fce03286cccf
30
+ ```
31
+
32
+ Restore role inheritance of list with title _test_ located in site _https://contoso.sharepoint.com/sites/project-x_
33
+
34
+ ```sh
35
+ m365 spo list roleinheritance reset --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle test
36
+ ```
@@ -0,0 +1,24 @@
1
+ # spo roledefinition list
2
+
3
+ Gets list of role definitions for the specified site
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo roledefinition list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site for which to retrieve role definitions
15
+
16
+ --8<-- "docs/cmd/_global.md"
17
+
18
+ ## Examples
19
+
20
+ Return list of role definitions for site _https://contoso.sharepoint.com/sites/project-x_
21
+
22
+ ```sh
23
+ m365 spo roledefinition list --webUrl https://contoso.sharepoint.com/sites/project-x
24
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.3.0-beta.c04ad6e",
3
+ "version": "5.3.0-beta.cb66cfd",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",