@pnp/cli-microsoft365 6.4.0-beta.b1f742c → 6.4.0-beta.e3b0f5c

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 (35) hide show
  1. package/.eslintrc.js +1 -0
  2. package/dist/Command.js +1 -0
  3. package/dist/m365/aad/commands/user/user-license-remove.js +2 -1
  4. package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +2 -9
  5. package/dist/m365/flow/commands/flow-disable.js +9 -2
  6. package/dist/m365/flow/commands/flow-enable.js +9 -2
  7. package/dist/m365/flow/commands/flow-get.js +9 -2
  8. package/dist/m365/flow/commands/flow-list.js +1 -1
  9. package/dist/m365/flow/commands/flow-remove.js +2 -2
  10. package/dist/m365/flow/commands/owner/owner-add.js +147 -0
  11. package/dist/m365/flow/commands/owner/owner-list.js +89 -0
  12. package/dist/m365/flow/commands/owner/owner-remove.js +147 -0
  13. package/dist/m365/flow/commands/run/run-cancel.js +9 -2
  14. package/dist/m365/flow/commands/run/run-list.js +5 -2
  15. package/dist/m365/flow/commands.js +3 -0
  16. package/dist/m365/planner/commands/roster/roster-member-get.js +98 -0
  17. package/dist/m365/planner/commands.js +1 -0
  18. package/dist/m365/spo/commands/customaction/customaction-get.js +27 -7
  19. package/dist/m365/spo/commands/term/term-get.js +68 -48
  20. package/dist/utils/aadGroup.js +18 -0
  21. package/docs/docs/cmd/aad/approleassignment/approleassignment-add.md +5 -5
  22. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +3 -3
  23. package/docs/docs/cmd/aad/user/user-remove.md +1 -1
  24. package/docs/docs/cmd/flow/owner/owner-add.md +61 -0
  25. package/docs/docs/cmd/flow/owner/owner-list.md +90 -0
  26. package/docs/docs/cmd/flow/owner/owner-remove.md +67 -0
  27. package/docs/docs/cmd/flow/run/run-list.md +28 -0
  28. package/docs/docs/cmd/planner/roster/roster-member-get.md +87 -0
  29. package/docs/docs/cmd/spo/customaction/customaction-get.md +113 -11
  30. package/docs/docs/cmd/spo/group/group-member-add.md +4 -4
  31. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +1 -1
  32. package/docs/docs/cmd/spo/navigation/navigation-node-set.md +1 -1
  33. package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +26 -26
  34. package/docs/docs/cmd/teams/channel/channel-member-add.md +2 -2
  35. package/package.json +1 -1
@@ -0,0 +1,98 @@
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 _PlannerRosterMemberGetCommand_instances, _PlannerRosterMemberGetCommand_initTelemetry, _PlannerRosterMemberGetCommand_initOptions, _PlannerRosterMemberGetCommand_initOptionSets, _PlannerRosterMemberGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const validation_1 = require("../../../../utils/validation");
20
+ const GraphCommand_1 = require("../../../base/GraphCommand");
21
+ const commands_1 = require("../../commands");
22
+ const aadUser_1 = require("../../../../utils/aadUser");
23
+ class PlannerRosterMemberGetCommand extends GraphCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.ROSTER_MEMBER_GET;
26
+ }
27
+ get description() {
28
+ return 'Gets a member of the specified Microsoft Planner Roster';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _PlannerRosterMemberGetCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initValidators).call(this);
36
+ __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptionSets).call(this);
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Retrieving member ${args.options.userName || args.options.userId} from the Microsoft Planner Roster`);
42
+ }
43
+ try {
44
+ const userId = yield this.getUserId(args);
45
+ const requestOptions = {
46
+ url: `${this.resource}/beta/planner/rosters/${args.options.rosterId}/members/${userId}`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ const response = yield request_1.default.get(requestOptions);
53
+ logger.log(response);
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err);
57
+ }
58
+ });
59
+ }
60
+ getUserId(args) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ if (args.options.userId) {
63
+ return args.options.userId;
64
+ }
65
+ return aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
66
+ });
67
+ }
68
+ }
69
+ _PlannerRosterMemberGetCommand_instances = new WeakSet(), _PlannerRosterMemberGetCommand_initTelemetry = function _PlannerRosterMemberGetCommand_initTelemetry() {
70
+ this.telemetry.push((args) => {
71
+ Object.assign(this.telemetryProperties, {
72
+ userId: typeof args.options.userId !== 'undefined',
73
+ userName: typeof args.options.userName !== 'undefined'
74
+ });
75
+ });
76
+ }, _PlannerRosterMemberGetCommand_initOptions = function _PlannerRosterMemberGetCommand_initOptions() {
77
+ this.options.unshift({
78
+ option: '--rosterId <rosterId>'
79
+ }, {
80
+ option: '--userId [userId]'
81
+ }, {
82
+ option: '--userName [userName]'
83
+ });
84
+ }, _PlannerRosterMemberGetCommand_initOptionSets = function _PlannerRosterMemberGetCommand_initOptionSets() {
85
+ this.optionSets.push({ options: ['userId', 'userName'] });
86
+ }, _PlannerRosterMemberGetCommand_initValidators = function _PlannerRosterMemberGetCommand_initValidators() {
87
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
88
+ if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
89
+ return `${args.options.userId} is not a valid GUID`;
90
+ }
91
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
92
+ return `${args.options.userName} is not a valid userName`;
93
+ }
94
+ return true;
95
+ }));
96
+ };
97
+ module.exports = new PlannerRosterMemberGetCommand();
98
+ //# sourceMappingURL=roster-member-get.js.map
@@ -15,6 +15,7 @@ exports.default = {
15
15
  ROSTER_ADD: `${prefix} roster add`,
16
16
  ROSTER_GET: `${prefix} roster get`,
17
17
  ROSTER_MEMBER_ADD: `${prefix} roster member add`,
18
+ ROSTER_MEMBER_GET: `${prefix} roster member get`,
18
19
  ROSTER_MEMBER_LIST: `${prefix} roster member list`,
19
20
  ROSTER_MEMBER_REMOVE: `${prefix} roster member remove`,
20
21
  ROSTER_REMOVE: `${prefix} roster remove`,
@@ -77,14 +77,26 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
77
77
  }
78
78
  return customAction;
79
79
  }
80
- const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}'`);
81
- if (customActions.length === 1) {
82
- return customActions[0];
80
+ else if (options.title) {
81
+ const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}'`);
82
+ if (customActions.length === 1) {
83
+ return customActions[0];
84
+ }
85
+ if (customActions.length === 0) {
86
+ throw `No user custom action with title '${options.title}' found`;
87
+ }
88
+ throw `Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
83
89
  }
84
- if (customActions.length === 0) {
85
- throw `No user custom action with title '${options.title}' found`;
90
+ else {
91
+ const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `ClientSideComponentId eq guid'${options.clientSideComponentId}'`);
92
+ if (customActions.length === 0) {
93
+ throw `No user custom action with ClientSideComponentId '${options.clientSideComponentId}' found`;
94
+ }
95
+ if (customActions.length > 1) {
96
+ throw `Multiple user custom actions with ClientSideComponentId '${options.clientSideComponentId}' found. Please disambiguate using IDs: ${customActions.map((customAction) => customAction.Id).join(', ')}`;
97
+ }
98
+ return customActions[0];
86
99
  }
87
- throw `Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
88
100
  });
89
101
  }
90
102
  humanizeScope(scope) {
@@ -100,6 +112,9 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
100
112
  _SpoCustomActionGetCommand_instances = new WeakSet(), _SpoCustomActionGetCommand_initTelemetry = function _SpoCustomActionGetCommand_initTelemetry() {
101
113
  this.telemetry.push((args) => {
102
114
  Object.assign(this.telemetryProperties, {
115
+ id: typeof args.options.id !== 'undefined',
116
+ title: typeof args.options.title !== 'undefined',
117
+ clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
103
118
  scope: args.options.scope || 'All'
104
119
  });
105
120
  });
@@ -108,6 +123,8 @@ _SpoCustomActionGetCommand_instances = new WeakSet(), _SpoCustomActionGetCommand
108
123
  option: '-i, --id [id]'
109
124
  }, {
110
125
  option: '-t, --title [title]'
126
+ }, {
127
+ option: '-c, --clientSideComponentId [clientSideComponentId]'
111
128
  }, {
112
129
  option: '-u, --webUrl <webUrl>'
113
130
  }, {
@@ -130,10 +147,13 @@ _SpoCustomActionGetCommand_instances = new WeakSet(), _SpoCustomActionGetCommand
130
147
  return `${args.options.scope} is not a valid custom action scope. Allowed values are Site|Web|All`;
131
148
  }
132
149
  }
150
+ if (args.options.clientSideComponentId && validation_1.validation.isValidGuid(args.options.clientSideComponentId) === false) {
151
+ return `${args.options.clientSideComponentId} is not a valid GUID.`;
152
+ }
133
153
  return true;
134
154
  }));
135
155
  }, _SpoCustomActionGetCommand_initOptionSets = function _SpoCustomActionGetCommand_initOptionSets() {
136
- this.optionSets.push({ options: ['id', 'title'] });
156
+ this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
137
157
  };
138
158
  module.exports = new SpoCustomActionGetCommand();
139
159
  //# sourceMappingURL=customaction-get.js.map
@@ -22,6 +22,7 @@ const spo_1 = require("../../../../utils/spo");
22
22
  const validation_1 = require("../../../../utils/validation");
23
23
  const SpoCommand_1 = require("../../../base/SpoCommand");
24
24
  const commands_1 = require("../../commands");
25
+ const os = require("os");
25
26
  class SpoTermGetCommand extends SpoCommand_1.default {
26
27
  get name() {
27
28
  return commands_1.default.TERM_GET;
@@ -50,32 +51,34 @@ class SpoTermGetCommand extends SpoCommand_1.default {
50
51
  data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="13" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticMethod Id="6" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="7" ParentId="6" Name="GetDefaultSiteCollectionTermStore" /><Method Id="13" ParentId="7" Name="GetTerm"><Parameters><Parameter Type="Guid">{${args.options.id}}</Parameter></Parameters></Method></ObjectPaths></Request>`;
51
52
  }
52
53
  else {
53
- const termGroupQuery = args.options.termGroupId ? `<Method Id="98" ParentId="96" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termGroupId}}</Parameter></Parameters></Method>` : `<Method Id="98" ParentId="96" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termGroupName)}</Parameter></Parameters></Method>`;
54
- const termSetQuery = args.options.termSetId ? `<Method Id="103" ParentId="101" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termSetId}}</Parameter></Parameters></Method>` : `<Method Id="103" ParentId="101" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termSetName)}</Parameter></Parameters></Method>`;
55
- data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="91" ObjectPathId="90" /><ObjectIdentityQuery Id="92" ObjectPathId="90" /><ObjectPath Id="94" ObjectPathId="93" /><ObjectIdentityQuery Id="95" ObjectPathId="93" /><ObjectPath Id="97" ObjectPathId="96" /><ObjectPath Id="99" ObjectPathId="98" /><ObjectIdentityQuery Id="100" ObjectPathId="98" /><ObjectPath Id="102" ObjectPathId="101" /><ObjectPath Id="104" ObjectPathId="103" /><ObjectIdentityQuery Id="105" ObjectPathId="103" /><ObjectPath Id="107" ObjectPathId="106" /><ObjectPath Id="109" ObjectPathId="108" /><ObjectIdentityQuery Id="110" ObjectPathId="108" /><Query Id="111" ObjectPathId="108"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticMethod Id="90" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="93" ParentId="90" Name="GetDefaultSiteCollectionTermStore" /><Property Id="96" ParentId="93" Name="Groups" />${termGroupQuery}<Property Id="101" ParentId="98" Name="TermSets" />${termSetQuery}<Property Id="106" ParentId="103" Name="Terms" /><Method Id="108" ParentId="106" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.name)}</Parameter></Parameters></Method></ObjectPaths></Request>`;
54
+ data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectIdentityQuery Id="3" ObjectPathId="1" /><ObjectPath Id="5" ObjectPathId="4" /><ObjectIdentityQuery Id="6" ObjectPathId="4" /><ObjectPath Id="8" ObjectPathId="7" /><ObjectPath Id="10" ObjectPathId="9" /><ObjectIdentityQuery Id="11" ObjectPathId="9" /><ObjectPath Id="13" ObjectPathId="12" /><ObjectPath Id="15" ObjectPathId="14" /><ObjectIdentityQuery Id="16" ObjectPathId="14" /><ObjectPath Id="18" ObjectPathId="17" /><SetProperty Id="19" ObjectPathId="17" Name="TrimUnavailable"><Parameter Type="Boolean">true</Parameter></SetProperty><SetProperty Id="20" ObjectPathId="17" Name="TermLabel"><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.name)}</Parameter></SetProperty><ObjectPath Id="22" ObjectPathId="21" /><Query Id="23" ObjectPathId="21"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><StaticMethod Id="1" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="4" ParentId="1" Name="GetDefaultSiteCollectionTermStore" /><Property Id="7" ParentId="4" Name="Groups" /><Method Id="9" ParentId="7" Name="${args.options.termGroupName === undefined ? "GetById" : "GetByName"}"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termGroupName) || args.options.termGroupId}</Parameter></Parameters></Method><Property Id="12" ParentId="9" Name="TermSets" /><Method Id="14" ParentId="12" Name="${args.options.termSetName === undefined ? "GetById" : "GetByName"}"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termSetName) || args.options.termSetId}</Parameter></Parameters></Method><Constructor Id="17" TypeId="{61a1d689-2744-4ea3-a88b-c95bee9803aa}" /><Method Id="21" ParentId="14" Name="GetTerms"><Parameters><Parameter ObjectPathId="17" /></Parameters></Method></ObjectPaths></Request>`;
56
55
  }
57
- const requestOptions = {
58
- url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
59
- headers: {
60
- 'X-RequestDigest': res.FormDigestValue
61
- },
62
- data: data
63
- };
64
- const processQuery = yield request_1.default.post(requestOptions);
65
- const json = JSON.parse(processQuery);
66
- const response = json[0];
67
- if (response.ErrorInfo) {
68
- throw response.ErrorInfo.ErrorMessage;
56
+ let term;
57
+ const csomResponse = yield this.executeCsomCall(data, spoAdminUrl, res);
58
+ if (csomResponse === null) {
59
+ throw `Term with id '${args.options.id}' could not be found.`;
69
60
  }
70
- const term = json[json.length - 1];
71
- if (!term) {
72
- return;
61
+ else if (csomResponse._Child_Items_ !== undefined) {
62
+ const terms = csomResponse;
63
+ if (terms._Child_Items_.length === 0) {
64
+ throw `Term with name '${args.options.name}' could not be found.`;
65
+ }
66
+ if (terms._Child_Items_.length > 1) {
67
+ const disambiguationText = terms._Child_Items_.map(c => {
68
+ return `- ${this.getTermId(c.Id)} - ${c.PathOfTerm}`;
69
+ }).join(os.EOL);
70
+ throw new Error(`Multiple terms with the specific term name found. Please disambiguate:${os.EOL}${disambiguationText}`);
71
+ }
72
+ term = terms._Child_Items_[0];
73
+ }
74
+ else {
75
+ term = csomResponse;
73
76
  }
74
77
  delete term._ObjectIdentity_;
75
78
  delete term._ObjectType_;
76
- term.CreatedDate = new Date(Number(term.CreatedDate.replace('/Date(', '').replace(')/', ''))).toISOString();
77
- term.Id = term.Id.replace('/Guid(', '').replace(')/', '');
78
- term.LastModifiedDate = new Date(Number(term.LastModifiedDate.replace('/Date(', '').replace(')/', ''))).toISOString();
79
+ term.CreatedDate = this.parseTermDateToIsoString(term.CreatedDate);
80
+ term.Id = this.getTermId(term.Id);
81
+ term.LastModifiedDate = this.parseTermDateToIsoString(term.LastModifiedDate);
79
82
  logger.log(term);
80
83
  }
81
84
  catch (err) {
@@ -83,6 +86,31 @@ class SpoTermGetCommand extends SpoCommand_1.default {
83
86
  }
84
87
  });
85
88
  }
89
+ executeCsomCall(data, spoAdminUrl, res) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const requestOptions = {
92
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
93
+ headers: {
94
+ 'X-RequestDigest': res.FormDigestValue
95
+ },
96
+ data: data
97
+ };
98
+ const processQuery = yield request_1.default.post(requestOptions);
99
+ const json = JSON.parse(processQuery);
100
+ const response = json[0];
101
+ if (response.ErrorInfo) {
102
+ throw response.ErrorInfo.ErrorMessage;
103
+ }
104
+ const responseObject = json[json.length - 1];
105
+ return responseObject;
106
+ });
107
+ }
108
+ getTermId(termId) {
109
+ return termId.replace('/Guid(', '').replace(')/', '');
110
+ }
111
+ parseTermDateToIsoString(dateAsString) {
112
+ return new Date(Number(dateAsString.replace('/Date(', '').replace(')/', ''))).toISOString();
113
+ }
86
114
  }
87
115
  _SpoTermGetCommand_instances = new WeakSet(), _SpoTermGetCommand_initTelemetry = function _SpoTermGetCommand_initTelemetry() {
88
116
  this.telemetry.push((args) => {
@@ -111,39 +139,31 @@ _SpoTermGetCommand_instances = new WeakSet(), _SpoTermGetCommand_initTelemetry =
111
139
  });
112
140
  }, _SpoTermGetCommand_initValidators = function _SpoTermGetCommand_initValidators() {
113
141
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
114
- if (args.options.id) {
115
- if (!validation_1.validation.isValidGuid(args.options.id)) {
116
- return `${args.options.id} is not a valid GUID`;
117
- }
142
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
143
+ return `${args.options.id} is not a valid GUID`;
118
144
  }
119
- if (args.options.name) {
120
- if (!args.options.termGroupId && !args.options.termGroupName) {
121
- return 'Specify termGroupId or termGroupName';
122
- }
123
- if (!args.options.termSetId && !args.options.termSetName) {
124
- return 'Specify termSetId or termSetName';
125
- }
145
+ if (args.options.termGroupId && !validation_1.validation.isValidGuid(args.options.termGroupId)) {
146
+ return `${args.options.termGroupId} is not a valid GUID`;
126
147
  }
127
- if (args.options.termGroupId && args.options.termGroupName) {
128
- return 'Specify termGroupId or termGroupName but not both';
129
- }
130
- if (args.options.termGroupId) {
131
- if (!validation_1.validation.isValidGuid(args.options.termGroupId)) {
132
- return `${args.options.termGroupId} is not a valid GUID`;
133
- }
134
- }
135
- if (args.options.termSetId && args.options.termSetName) {
136
- return 'Specify termSetId or termSetName but not both';
137
- }
138
- if (args.options.termSetId) {
139
- if (!validation_1.validation.isValidGuid(args.options.termSetId)) {
140
- return `${args.options.termSetId} is not a valid GUID`;
141
- }
148
+ if (args.options.termSetId && !validation_1.validation.isValidGuid(args.options.termSetId)) {
149
+ return `${args.options.termSetId} is not a valid GUID`;
142
150
  }
143
151
  return true;
144
152
  }));
145
153
  }, _SpoTermGetCommand_initOptionSets = function _SpoTermGetCommand_initOptionSets() {
146
- this.optionSets.push({ options: ['id', 'name'] });
154
+ this.optionSets.push({
155
+ options: ['id', 'name']
156
+ }, {
157
+ options: ['termGroupId', 'termGroupName'],
158
+ runsWhen: (args) => {
159
+ return args.options.name !== undefined;
160
+ }
161
+ }, {
162
+ options: ['termSetId', 'termSetName'],
163
+ runsWhen: (args) => {
164
+ return args.options.name !== undefined;
165
+ }
166
+ });
147
167
  };
148
168
  module.exports = new SpoTermGetCommand();
149
169
  //# sourceMappingURL=term-get.js.map
@@ -53,6 +53,24 @@ exports.aadGroup = {
53
53
  }
54
54
  return groups[0];
55
55
  });
56
+ },
57
+ /**
58
+ * Get id of a group by its display name.
59
+ * @param displayName Group display name.
60
+ * @throws Error when group was not found.
61
+ * @throws Error when multiple groups with the same name were found.
62
+ */
63
+ getGroupIdByDisplayName(displayName) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const groups = yield odata_1.odata.getAllItems(`${graphResource}/v1.0/groups?$filter=displayName eq '${formatting_1.formatting.encodeQueryParameter(displayName)}'&$select=id`);
66
+ if (!groups.length) {
67
+ throw Error(`The specified group '${displayName}' does not exist.`);
68
+ }
69
+ if (groups.length > 1) {
70
+ throw Error(`Multiple groups with name '${displayName}' found: ${groups.map(x => x.id).join(',')}.`);
71
+ }
72
+ return groups[0].id;
73
+ });
56
74
  }
57
75
  };
58
76
  //# sourceMappingURL=aadGroup.js.map
@@ -20,10 +20,10 @@ m365 aad approleassignment add [options]
20
20
  : Application name of the App Registration to which the configured scopes (app roles) should be applied
21
21
 
22
22
  `-r, --resource <resource>`
23
- : Service principal name, appId or objectId that has the scopes (roles) ex. `SharePoint`.
23
+ : Service principal name, appId or objectId that has the scopes (roles) e.g. `SharePoint`.
24
24
 
25
25
  `-s, --scope <scope>`
26
- : Permissions known also as scopes and roles to grant the application with. If multiple permissions have to be granted, they have to be comma separated ex. `Sites.Read.All,Sites.ReadWrite.all`
26
+ : Permissions known also as scopes and roles to grant the application with. If multiple permissions have to be granted, they have to be comma-separated e.g. `Sites.Read.All,Sites.ReadWrite.all`
27
27
 
28
28
  --8<-- "docs/cmd/_global.md"
29
29
 
@@ -33,7 +33,7 @@ This command requires tenant administrator permissions.
33
33
 
34
34
  Specify either the `appId`, `appObjectId` or `appDisplayName` but not multiple. If you specify more than one option value, the command will fail with an error.
35
35
 
36
- Autocomplete values for the `resource` option do not mean allowed values. The autocomplete will just suggest some known names, but that doesn't restrict you to use name of your own custom application or other application within your tenant.
36
+ Autocomplete values for the `resource` option do not mean allowed values. The autocomplete will just suggest some known names, but that doesn't restrict you to use the name of your own custom application or other application within your tenant.
37
37
 
38
38
  This command can also be used to assign permissions to system or user-assigned managed identity.
39
39
 
@@ -45,13 +45,13 @@ Adds SharePoint _Sites.Read.All_ application permissions to Azure AD application
45
45
  m365 aad approleassignment add --appId "57907bf8-73fa-43a6-89a5-1f603e29e451" --resource "SharePoint" --scope "Sites.Read.All"
46
46
  ```
47
47
 
48
- Adds multiple Microsoft Graph application permissions to an Azure AD application with name _MyAppName_
48
+ Adds multiple Microsoft Graph application permissions to an Azure AD application with the name _MyAppName__
49
49
 
50
50
  ```sh
51
51
  m365 aad approleassignment add --appDisplayName "MyAppName" --resource "Microsoft Graph" --scope "Mail.Read,Mail.Send"
52
52
  ```
53
53
 
54
- Adds Microsoft Graph _Mail.Read_ application permissions to a system managed identity app with objectId _57907bf8-73fa-43a6-89a5-1f603e29e451_
54
+ Adds Microsoft Graph _Mail.Read_ application permissions to a system-managed identity app with objectId _57907bf8-73fa-43a6-89a5-1f603e29e451_
55
55
 
56
56
  ```sh
57
57
  m365 aad approleassignment add --appObjectId "57907bf8-73fa-43a6-89a5-1f603e29e451" --resource "Microsoft Graph" --scope "Mail.Read"
@@ -20,10 +20,10 @@ m365 aad approleassignment remove [options]
20
20
  : Application name of the App Registration for which the configured scopes (app roles) should be deleted
21
21
 
22
22
  `-r, --resource <resource>`
23
- : Service principal name, appId or objectId that has the scopes (roles) ex. `SharePoint`
23
+ : Service principal name, appId or objectId that has the scopes (roles) e.g. `SharePoint`
24
24
 
25
25
  `-s, --scope <scope>`
26
- : Permissions known also as scopes and roles to be deleted from the application. If multiple permissions have to be deleted, they have to be comma separated ex. `Sites.Read.All`,`Sites.ReadWrite.All`
26
+ : Permissions known also as scopes and roles to be deleted from the application. If multiple permissions have to be deleted, they have to be comma-separated e.g. `Sites.Read.All`,`Sites.ReadWrite.All`
27
27
 
28
28
  `--confirm`
29
29
  : Don't prompt for confirming removing the all role assignment
@@ -54,7 +54,7 @@ Deletes multiple Microsoft Graph application permissions from an Azure AD applic
54
54
  m365 aad approleassignment remove --appDisplayName "MyAppName" --resource "Microsoft Graph" --scope "Mail.Read,Mail.Send"
55
55
  ```
56
56
 
57
- Deletes Microsoft Graph _Mail.Read_ application permissions from a system managed identity app with objectId _57907bf8-73fa-43a6-89a5-1f603e29e451_
57
+ Deletes Microsoft Graph _Mail.Read_ application permissions from a system-managed identity app with objectId _57907bf8-73fa-43a6-89a5-1f603e29e451_
58
58
 
59
59
  ```sh
60
60
  m365 aad approleassignment remove --appObjectId "57907bf8-73fa-43a6-89a5-1f603e29e451" --resource "Microsoft Graph" --scope "Mail.Read"
@@ -43,7 +43,7 @@ m365 aad user remove --id a33bd401-9117-4e0e-bb7b-3f61c1539e10
43
43
  Removes a specific user by its UPN
44
44
 
45
45
  ```sh
46
- m365 aad user remove --name john.doe@contoso.com
46
+ m365 aad user remove --userName john.doe@contoso.com
47
47
  ```
48
48
 
49
49
  ## Response
@@ -0,0 +1,61 @@
1
+ # flow owner add
2
+
3
+ Assigns permissions to a Power Automate flow
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 flow owner add [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-e, --environmentName <environmentName>`
14
+ : The name of the environment.
15
+
16
+ `-f, --flowName <flowName>`
17
+ : The name of the Power Automate flow.
18
+
19
+ `--userId [userId]`
20
+ : The ID of the user. Specify either `userId`, `userName`, `groupId` or `groupName`.
21
+
22
+ `--userName [userName]`
23
+ : User principal name of the user. Specify either `userId`, `userName`, `groupId` or `groupName`.
24
+
25
+ `--groupId [groupId]`
26
+ : The ID of the group. Specify either `userId`, `userName`, `groupId` or `groupName`.
27
+
28
+ `--groupName [groupName]`
29
+ : The name of the group. Specify either `userId`, `userName`, `groupId` or `groupName`.
30
+
31
+ `--roleName <roleName>`
32
+ : Access level for the user on the flow. Valid options are `CanView` or `CanEdit`.
33
+
34
+ `--asAdmin`
35
+ : Run the command as admin.
36
+
37
+ --8<-- "docs/cmd/_global.md"
38
+
39
+ ## Examples
40
+
41
+ Assign owner permissions to a specific Power Automate flow for a user with ID
42
+
43
+ ```sh
44
+ m365 flow owner add --userId 5c241023-2ba5-4ea8-a516-a2481a3e6c51 --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --roleName CanEdit
45
+ ```
46
+
47
+ Assign owner permissions to a specific Power Automate flow for a user with UPN
48
+
49
+ ```sh
50
+ m365 flow owner add --userName "john.doe@contoso.com" --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --roleName CanEdit
51
+ ```
52
+
53
+ Assign owner permissions to a specific Power Automate flow for a group
54
+
55
+ ```sh
56
+ m365 flow owner add --groupId 8d4d9f32-1ab0-4f81-9054-efbb1759e8e6 --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --roleName CanEdit
57
+ ```
58
+
59
+ ## Response
60
+
61
+ The command won't return a response on success.
@@ -0,0 +1,90 @@
1
+ # flow owner list
2
+
3
+ Lists all owners of a Power Automate flow
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 flow owner list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-e, --environmentName <environmentName>`
14
+ : The name of the environment.
15
+
16
+ `-f, --flowName <flowName>`
17
+ : The name of the Power Automate flow.
18
+
19
+ `--asAdmin`
20
+ : Run the command as admin.
21
+
22
+ --8<-- "docs/cmd/_global.md"
23
+
24
+ ## Examples
25
+
26
+ Gets the owners by the name of the Power Automate flow within a specified environment
27
+
28
+ ```sh
29
+ m365 flow owner list --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72
30
+ ```
31
+
32
+ Gets the owners by the name of the Power Automate flow within a specified environment with admin privileges
33
+
34
+ ```sh
35
+ m365 flow owner list --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --asAdmin
36
+ ```
37
+
38
+ ## Response
39
+
40
+ === "JSON"
41
+
42
+ ```json
43
+ [
44
+ {
45
+ "name": "fe36f75e-c103-410b-a18a-2bf6df06ac3a",
46
+ "id": "/providers/Microsoft.ProcessSimple/environments/Default-c5a5d746-3520-453f-8a69-780f8e44917e/flows/72f2be4a-78c1-4220-a048-dbf557296a72/permissions/fe36f75e-c103-410b-a18a-2bf6df06ac3a",
47
+ "type": "/providers/Microsoft.ProcessSimple/environments/flows/permissions",
48
+ "properties": {
49
+ "roleName": "Owner",
50
+ "permissionType": "Principal",
51
+ "principal": {
52
+ "id": "fe36f75e-c103-410b-a18a-2bf6df06ac3a",
53
+ "type": "User"
54
+ }
55
+ }
56
+ }
57
+ ]
58
+ ```
59
+
60
+ === "Text"
61
+
62
+ ```text
63
+ roleName id type
64
+ -------- ------------------------------------ ----
65
+ Owner fe36f75e-c103-410b-a18a-2bf6df06ac3a User
66
+ ```
67
+
68
+ === "CSV"
69
+
70
+ ```csv
71
+ roleName,id,type
72
+ Owner,fe36f75e-c103-410b-a18a-2bf6df06ac3a,User
73
+ ```
74
+
75
+ === "Markdown"
76
+
77
+ ```md
78
+ # flow owner list --environmentName "Default-c5a5d746-3520-453f-8a69-780f8e44917e" --flowName "72f2be4a-78c1-4220-a048-dbf557296a72"
79
+
80
+ Date: 25/02/2023
81
+
82
+ ## fe36f75e-c103-410b-a18a-2bf6df06ac3a (/providers/Microsoft.ProcessSimple/environments/Default-c5a5d746-3520-453f-8a69-780f8e44917e/flows/72f2be4a-78c1-4220-a048-dbf557296a72/permissions/fe36f75e-c103-410b-a18a-2bf6df06ac3a)
83
+
84
+ Property | Value
85
+ ---------|-------
86
+ name | fe36f75e-c103-410b-a18a-2bf6df06ac3a
87
+ id | /providers/Microsoft.ProcessSimple/environments/Default-c5a5d746-3520-453f-8a69-780f8e44917e/flows/72f2be4a-78c1-4220-a048-dbf557296a72/permissions/fe36f75e-c103-410b-a18a-2bf6df06ac3a
88
+ type | /providers/Microsoft.ProcessSimple/environments/flows/permissions
89
+ properties | {"roleName":"Owner","permissionType":"Principal","principal":{"id":"fe36f75e-c103-410b-a18a-2bf6df06ac3a","type":"User"}}
90
+ ```