@pnp/cli-microsoft365 7.4.0-beta.5c123d7 → 7.4.0-beta.8d6724f
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.cjs +6 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +2 -1
- package/dist/appInsights.js +2 -0
- package/dist/m365/entra/aadCommands.js +1 -0
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-roleassignment-add.js +102 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/external/commands/connection/connection-urltoitemresolver-add.js +69 -0
- package/dist/m365/external/commands.js +1 -0
- package/dist/m365/flow/commands/run/run-get.js +52 -13
- package/dist/m365/spo/commands/group/group-member-add.js +21 -4
- package/dist/m365/spo/commands/group/group-member-remove.js +27 -10
- package/dist/m365/spo/commands/user/user-ensure.js +16 -6
- package/dist/m365/teams/commands/user/user-app-add.js +35 -3
- package/dist/request.js +16 -0
- package/dist/utils/roleAssignment.js +42 -0
- package/dist/utils/roleDefinition.js +24 -0
- package/docs/docs/cmd/entra/administrativeunit/administrativeunit-roleassignment-add.mdx +116 -0
- package/docs/docs/cmd/external/connection/connection-urltoitemresolver-add.mdx +47 -0
- package/docs/docs/cmd/flow/run/run-get.mdx +167 -4
- package/docs/docs/cmd/spo/group/group-member-add.mdx +19 -7
- package/docs/docs/cmd/spo/group/group-member-remove.mdx +12 -6
- package/docs/docs/cmd/spo/user/user-ensure.mdx +8 -5
- package/docs/docs/cmd/teams/user/user-app-add.mdx +8 -5
- package/package.json +1 -1
package/dist/Auth.js
CHANGED
package/dist/appInsights.js
CHANGED
|
@@ -24,6 +24,8 @@ appInsightsClient.commonProperties = {
|
|
|
24
24
|
env: env,
|
|
25
25
|
ci: Boolean(process.env.CI).toString()
|
|
26
26
|
};
|
|
27
|
+
appInsightsClient.config.proxyHttpUrl = process.env.HTTP_PROXY ?? '';
|
|
28
|
+
appInsightsClient.config.proxyHttpsUrl = process.env.HTTPS_PROXY ?? '';
|
|
27
29
|
appInsightsClient.context.tags['ai.cloud.roleInstance'] = crypto.createHash('sha256').update(appInsightsClient.context.tags['ai.cloud.roleInstance']).digest('hex');
|
|
28
30
|
delete appInsightsClient.context.tags['ai.cloud.role'];
|
|
29
31
|
delete appInsightsClient.context.tags['ai.cloud.roleName'];
|
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
ADMINISTRATIVEUNIT_MEMBER_ADD: `${prefix} administrativeunit member add`,
|
|
8
8
|
ADMINISTRATIVEUNIT_MEMBER_GET: `${prefix} administrativeunit member get`,
|
|
9
9
|
ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
|
|
10
|
+
ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD: `${prefix} administrativeunit roleassignment add`,
|
|
10
11
|
APP_ADD: `${prefix} app add`,
|
|
11
12
|
APP_GET: `${prefix} app get`,
|
|
12
13
|
APP_LIST: `${prefix} app list`,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions, _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets;
|
|
7
|
+
import { aadAdministrativeUnit } from '../../../../utils/aadAdministrativeUnit.js';
|
|
8
|
+
import { aadUser } from '../../../../utils/aadUser.js';
|
|
9
|
+
import { roleAssignment } from '../../../../utils/roleAssignment.js';
|
|
10
|
+
import { roleDefinition } from '../../../../utils/roleDefinition.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class EntraAdministrativeUnitRoleAssignmentAddCommand extends GraphCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Assigns a Microsoft Entra role with administrative unit scope to a user';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_EntraAdministrativeUnitRoleAssignmentAddCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _EntraAdministrativeUnitRoleAssignmentAddCommand_instances, "m", _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
try {
|
|
31
|
+
let { administrativeUnitId, roleDefinitionId, userId } = args.options;
|
|
32
|
+
if (args.options.administrativeUnitName) {
|
|
33
|
+
if (this.verbose) {
|
|
34
|
+
await logger.logToStderr(`Retrieving administrative unit by its name '${args.options.administrativeUnitName}'`);
|
|
35
|
+
}
|
|
36
|
+
administrativeUnitId = (await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
|
|
37
|
+
}
|
|
38
|
+
if (args.options.roleDefinitionName) {
|
|
39
|
+
if (this.verbose) {
|
|
40
|
+
await logger.logToStderr(`Retrieving role definition by its name '${args.options.roleDefinitionName}'`);
|
|
41
|
+
}
|
|
42
|
+
roleDefinitionId = (await roleDefinition.getRoleDefinitionByDisplayName(args.options.roleDefinitionName)).id;
|
|
43
|
+
}
|
|
44
|
+
if (args.options.userName) {
|
|
45
|
+
if (this.verbose) {
|
|
46
|
+
await logger.logToStderr(`Retrieving user by UPN '${args.options.userName}'`);
|
|
47
|
+
}
|
|
48
|
+
userId = await aadUser.getUserIdByUpn(args.options.userName);
|
|
49
|
+
}
|
|
50
|
+
const unifiedRoleAssignment = await roleAssignment.createRoleAssignmentWithAdministrativeUnitScope(roleDefinitionId, userId, administrativeUnitId);
|
|
51
|
+
await logger.log(unifiedRoleAssignment);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
this.handleRejectedODataJsonPromise(err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_EntraAdministrativeUnitRoleAssignmentAddCommand_instances = new WeakSet(), _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initTelemetry() {
|
|
59
|
+
this.telemetry.push((args) => {
|
|
60
|
+
Object.assign(this.telemetryProperties, {
|
|
61
|
+
administrativeUnitId: typeof args.options.administrativeUnitId !== 'undefined',
|
|
62
|
+
administrativeUnitName: typeof args.options.administrativeUnitName !== 'undefined',
|
|
63
|
+
roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
|
|
64
|
+
roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined',
|
|
65
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
66
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptions() {
|
|
70
|
+
this.options.unshift({
|
|
71
|
+
option: '-i, --administrativeUnitId [administrativeUnitId]'
|
|
72
|
+
}, {
|
|
73
|
+
option: '-n, --administrativeUnitName [administrativeUnitName]'
|
|
74
|
+
}, {
|
|
75
|
+
option: '--roleDefinitionId [roleDefinitionId]'
|
|
76
|
+
}, {
|
|
77
|
+
option: '--roleDefinitionName [roleDefinitionName]'
|
|
78
|
+
}, {
|
|
79
|
+
option: '--userId [userId]'
|
|
80
|
+
}, {
|
|
81
|
+
option: '--userName [userName]'
|
|
82
|
+
});
|
|
83
|
+
}, _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initValidators() {
|
|
84
|
+
this.validators.push(async (args) => {
|
|
85
|
+
if (args.options.administrativeUnitId && !validation.isValidGuid(args.options.administrativeUnitId)) {
|
|
86
|
+
return `${args.options.administrativeUnitId} is not a valid GUID`;
|
|
87
|
+
}
|
|
88
|
+
if (args.options.roleDefinitionId && !validation.isValidGuid(args.options.roleDefinitionId)) {
|
|
89
|
+
return `${args.options.roleDefinitionId} is not a valid GUID`;
|
|
90
|
+
}
|
|
91
|
+
if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
|
|
92
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
}, _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets = function _EntraAdministrativeUnitRoleAssignmentAddCommand_initOptionSets() {
|
|
97
|
+
this.optionSets.push({ options: ['administrativeUnitId', 'administrativeUnitName'] });
|
|
98
|
+
this.optionSets.push({ options: ['roleDefinitionId', 'roleDefinitionName'] });
|
|
99
|
+
this.optionSets.push({ options: ['userId', 'userName'] });
|
|
100
|
+
};
|
|
101
|
+
export default new EntraAdministrativeUnitRoleAssignmentAddCommand();
|
|
102
|
+
//# sourceMappingURL=administrativeunit-roleassignment-add.js.map
|
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
ADMINISTRATIVEUNIT_MEMBER_ADD: `${prefix} administrativeunit member add`,
|
|
8
8
|
ADMINISTRATIVEUNIT_MEMBER_GET: `${prefix} administrativeunit member get`,
|
|
9
9
|
ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
|
|
10
|
+
ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD: `${prefix} administrativeunit roleassignment add`,
|
|
10
11
|
APP_ADD: `${prefix} app add`,
|
|
11
12
|
APP_GET: `${prefix} app get`,
|
|
12
13
|
APP_LIST: `${prefix} app list`,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _ExternalConnectionUrlToItemResolverAddCommand_instances, _ExternalConnectionUrlToItemResolverAddCommand_initOptions;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
|
+
import commands from '../../commands.js';
|
|
10
|
+
class ExternalConnectionUrlToItemResolverAddCommand extends GraphCommand {
|
|
11
|
+
get name() {
|
|
12
|
+
return commands.CONNECTION_URLTOITEMRESOLVER_ADD;
|
|
13
|
+
}
|
|
14
|
+
get description() {
|
|
15
|
+
return 'Adds a URL to item resolver to an external connection';
|
|
16
|
+
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
_ExternalConnectionUrlToItemResolverAddCommand_instances.add(this);
|
|
20
|
+
__classPrivateFieldGet(this, _ExternalConnectionUrlToItemResolverAddCommand_instances, "m", _ExternalConnectionUrlToItemResolverAddCommand_initOptions).call(this);
|
|
21
|
+
}
|
|
22
|
+
async commandAction(logger, args) {
|
|
23
|
+
const baseUrls = args.options.baseUrls.split(',').map(b => b.trim());
|
|
24
|
+
const itemIdResolver = {
|
|
25
|
+
itemId: args.options.itemId,
|
|
26
|
+
priority: args.options.priority,
|
|
27
|
+
urlMatchInfo: {
|
|
28
|
+
baseUrls: baseUrls,
|
|
29
|
+
urlPattern: args.options.urlPattern
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
// not a part of the type definition, but required by the API
|
|
33
|
+
itemIdResolver['@odata.type'] = '#microsoft.graph.externalConnectors.itemIdResolver';
|
|
34
|
+
const requestOptions = {
|
|
35
|
+
url: `${this.resource}/v1.0/external/connections/${args.options.externalConnectionId}`,
|
|
36
|
+
headers: {
|
|
37
|
+
accept: 'application/json;odata.metadata=none',
|
|
38
|
+
'content-type': 'application/json'
|
|
39
|
+
},
|
|
40
|
+
responseType: 'json',
|
|
41
|
+
data: {
|
|
42
|
+
activitySettings: {
|
|
43
|
+
urlToItemResolvers: [itemIdResolver]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
await request.patch(requestOptions);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
this.handleRejectedODataJsonPromise(err);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
_ExternalConnectionUrlToItemResolverAddCommand_instances = new WeakSet(), _ExternalConnectionUrlToItemResolverAddCommand_initOptions = function _ExternalConnectionUrlToItemResolverAddCommand_initOptions() {
|
|
56
|
+
this.options.unshift({
|
|
57
|
+
option: '-c, --externalConnectionId <externalConnectionId>'
|
|
58
|
+
}, {
|
|
59
|
+
option: '--baseUrls <baseUrls>'
|
|
60
|
+
}, {
|
|
61
|
+
option: '--urlPattern <urlPattern>'
|
|
62
|
+
}, {
|
|
63
|
+
option: '-i, --itemId <itemId>'
|
|
64
|
+
}, {
|
|
65
|
+
option: '-p, --priority <priority>'
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
export default new ExternalConnectionUrlToItemResolverAddCommand();
|
|
69
|
+
//# sourceMappingURL=connection-urltoitemresolver-add.js.map
|
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
CONNECTION_LIST: `${prefix} connection list`,
|
|
8
8
|
CONNECTION_REMOVE: `${prefix} connection remove`,
|
|
9
9
|
CONNECTION_SCHEMA_ADD: `${prefix} connection schema add`,
|
|
10
|
+
CONNECTION_URLTOITEMRESOLVER_ADD: `${prefix} connection urltoitemresolver add`,
|
|
10
11
|
EXTERNALCONNECTION_ADD: `${searchPrefix} externalconnection add`,
|
|
11
12
|
EXTERNALCONNECTION_GET: `${searchPrefix} externalconnection get`,
|
|
12
13
|
EXTERNALCONNECTION_LIST: `${searchPrefix} externalconnection list`,
|
|
@@ -30,8 +30,12 @@ class FlowRunGetCommand extends PowerAutomateCommand {
|
|
|
30
30
|
if (this.verbose) {
|
|
31
31
|
await logger.logToStderr(`Retrieving information about run ${args.options.name} of Microsoft Flow ${args.options.flowName}...`);
|
|
32
32
|
}
|
|
33
|
+
if (args.options.includeTriggerInformation) {
|
|
34
|
+
await this.warn(logger, `Parameter 'includeTriggerInformation' is deprecated. Please use 'withTrigger instead`);
|
|
35
|
+
}
|
|
36
|
+
const actionsParameter = args.options.withActions ? '$expand=properties%2Factions&' : '';
|
|
33
37
|
const requestOptions = {
|
|
34
|
-
url: `${this.resource}/providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs/${formatting.encodeQueryParameter(args.options.name)}
|
|
38
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs/${formatting.encodeQueryParameter(args.options.name)}?${actionsParameter}api-version=2016-11-01`,
|
|
35
39
|
headers: {
|
|
36
40
|
accept: 'application/json'
|
|
37
41
|
},
|
|
@@ -43,17 +47,11 @@ class FlowRunGetCommand extends PowerAutomateCommand {
|
|
|
43
47
|
res.endTime = res.properties.endTime || '';
|
|
44
48
|
res.status = res.properties.status;
|
|
45
49
|
res.triggerName = res.properties.trigger.name;
|
|
46
|
-
if (args.options.includeTriggerInformation && res.properties.trigger.outputsLink) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'x-anonymous': true
|
|
52
|
-
},
|
|
53
|
-
responseType: 'json'
|
|
54
|
-
};
|
|
55
|
-
const triggerInformationResponse = await request.get(triggerInformationOptions);
|
|
56
|
-
res.triggerInformation = triggerInformationResponse.body;
|
|
50
|
+
if ((args.options.includeTriggerInformation || args.options.withTrigger) && res.properties.trigger.outputsLink) {
|
|
51
|
+
res.triggerInformation = await this.getTriggerInformation(res);
|
|
52
|
+
}
|
|
53
|
+
if (!!args.options.withActions) {
|
|
54
|
+
res.actions = await this.getActionsInformation(res, args.options.withActions);
|
|
57
55
|
}
|
|
58
56
|
await logger.log(res);
|
|
59
57
|
}
|
|
@@ -61,6 +59,38 @@ class FlowRunGetCommand extends PowerAutomateCommand {
|
|
|
61
59
|
this.handleRejectedODataJsonPromise(err);
|
|
62
60
|
}
|
|
63
61
|
}
|
|
62
|
+
async getTriggerInformation(res) {
|
|
63
|
+
return await this.requestAdditionalInformation(res.properties.trigger.outputsLink.uri);
|
|
64
|
+
}
|
|
65
|
+
async getActionsInformation(res, withActions) {
|
|
66
|
+
const chosenActions = typeof withActions === 'string' ? withActions.split(',') : null;
|
|
67
|
+
const actionsResult = {};
|
|
68
|
+
for (const action in res.properties.actions) {
|
|
69
|
+
if (!res.properties.actions[action] || (chosenActions && chosenActions.indexOf(action) === -1)) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
actionsResult[action] = res.properties.actions[action];
|
|
73
|
+
if (!!res.properties.actions[action].inputsLink?.uri) {
|
|
74
|
+
actionsResult[action].input = await this.requestAdditionalInformation(res.properties.actions[action].inputsLink?.uri);
|
|
75
|
+
}
|
|
76
|
+
if (!!res.properties.actions[action].outputsLink?.uri) {
|
|
77
|
+
actionsResult[action].output = await this.requestAdditionalInformation(res.properties.actions[action].outputsLink?.uri);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return actionsResult;
|
|
81
|
+
}
|
|
82
|
+
async requestAdditionalInformation(requestUri) {
|
|
83
|
+
const additionalInformationOptions = {
|
|
84
|
+
url: requestUri,
|
|
85
|
+
headers: {
|
|
86
|
+
accept: 'application/json',
|
|
87
|
+
'x-anonymous': true
|
|
88
|
+
},
|
|
89
|
+
responseType: 'json'
|
|
90
|
+
};
|
|
91
|
+
const additionalInformationResponse = await request.get(additionalInformationOptions);
|
|
92
|
+
return additionalInformationResponse.body ? additionalInformationResponse.body : additionalInformationResponse;
|
|
93
|
+
}
|
|
64
94
|
}
|
|
65
95
|
_FlowRunGetCommand_instances = new WeakSet(), _FlowRunGetCommand_initOptions = function _FlowRunGetCommand_initOptions() {
|
|
66
96
|
this.options.unshift({
|
|
@@ -71,18 +101,27 @@ _FlowRunGetCommand_instances = new WeakSet(), _FlowRunGetCommand_initOptions = f
|
|
|
71
101
|
option: '-e, --environmentName <environmentName>'
|
|
72
102
|
}, {
|
|
73
103
|
option: '--includeTriggerInformation'
|
|
104
|
+
}, {
|
|
105
|
+
option: '--withTrigger'
|
|
106
|
+
}, {
|
|
107
|
+
option: '--withActions [withActions]'
|
|
74
108
|
});
|
|
75
109
|
}, _FlowRunGetCommand_initValidators = function _FlowRunGetCommand_initValidators() {
|
|
76
110
|
this.validators.push(async (args) => {
|
|
77
111
|
if (!validation.isValidGuid(args.options.flowName)) {
|
|
78
112
|
return `${args.options.flowName} is not a valid GUID`;
|
|
79
113
|
}
|
|
114
|
+
if (args.options.withActions && (typeof args.options.withActions !== 'string' && typeof args.options.withActions !== 'boolean')) {
|
|
115
|
+
return 'the withActions parameter must be a string or boolean';
|
|
116
|
+
}
|
|
80
117
|
return true;
|
|
81
118
|
});
|
|
82
119
|
}, _FlowRunGetCommand_initTelemetry = function _FlowRunGetCommand_initTelemetry() {
|
|
83
120
|
this.telemetry.push((args) => {
|
|
84
121
|
Object.assign(this.telemetryProperties, {
|
|
85
|
-
includeTriggerInformation: !!args.options.includeTriggerInformation
|
|
122
|
+
includeTriggerInformation: !!args.options.includeTriggerInformation,
|
|
123
|
+
withTrigger: !!args.options.withTrigger,
|
|
124
|
+
withActions: typeof args.options.withActions !== 'undefined'
|
|
86
125
|
});
|
|
87
126
|
});
|
|
88
127
|
};
|
|
@@ -32,6 +32,14 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
32
32
|
}
|
|
33
33
|
async commandAction(logger, args) {
|
|
34
34
|
try {
|
|
35
|
+
if (args.options.aadGroupIds) {
|
|
36
|
+
args.options.entraGroupIds = args.options.aadGroupIds;
|
|
37
|
+
this.warn(logger, `Option 'aadGroupIds' is deprecated. Please use 'entraGroupIds' instead`);
|
|
38
|
+
}
|
|
39
|
+
if (args.options.aadGroupNames) {
|
|
40
|
+
args.options.entraGroupNames = args.options.aadGroupNames;
|
|
41
|
+
this.warn(logger, `Option 'aadGroupNames' is deprecated. Please use 'entraGroupNames' instead`);
|
|
42
|
+
}
|
|
35
43
|
const groupId = await this.getGroupId(args, logger);
|
|
36
44
|
const resolvedUsernameList = await this.getValidUsers(args, logger);
|
|
37
45
|
if (this.verbose) {
|
|
@@ -82,7 +90,7 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
82
90
|
await logger.logToStderr('Checking if the specified users and groups exist');
|
|
83
91
|
}
|
|
84
92
|
const validUserNames = [];
|
|
85
|
-
const identifiers = args.options.userNames ?? args.options.emails ?? args.options.
|
|
93
|
+
const identifiers = args.options.userNames ?? args.options.emails ?? args.options.entraGroupIds ?? args.options.entraGroupNames ?? args.options.userIds.toString();
|
|
86
94
|
await Promise.all(identifiers.split(',').map(async (identifier) => {
|
|
87
95
|
const trimmedIdentifier = identifier.trim();
|
|
88
96
|
try {
|
|
@@ -96,10 +104,10 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
96
104
|
else if (args.options.userNames) {
|
|
97
105
|
validUserNames.push(trimmedIdentifier);
|
|
98
106
|
}
|
|
99
|
-
else if (args.options.
|
|
107
|
+
else if (args.options.entraGroupIds) {
|
|
100
108
|
validUserNames.push(trimmedIdentifier);
|
|
101
109
|
}
|
|
102
|
-
else if (args.options.
|
|
110
|
+
else if (args.options.entraGroupNames) {
|
|
103
111
|
if (this.verbose) {
|
|
104
112
|
await logger.logToStderr(`Getting ID of Azure AD group ${trimmedIdentifier}`);
|
|
105
113
|
}
|
|
@@ -135,7 +143,9 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
|
|
|
135
143
|
userNames: typeof args.options.userNames !== 'undefined',
|
|
136
144
|
emails: typeof args.options.emails !== 'undefined',
|
|
137
145
|
userIds: typeof args.options.userIds !== 'undefined',
|
|
146
|
+
entraGroupIds: typeof args.options.entraGroupIds !== 'undefined',
|
|
138
147
|
aadGroupIds: typeof args.options.aadGroupIds !== 'undefined',
|
|
148
|
+
entraGroupNames: typeof args.options.entraGroupNames !== 'undefined',
|
|
139
149
|
aadGroupNames: typeof args.options.aadGroupNames !== 'undefined'
|
|
140
150
|
});
|
|
141
151
|
});
|
|
@@ -152,8 +162,12 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
|
|
|
152
162
|
option: '--emails [emails]'
|
|
153
163
|
}, {
|
|
154
164
|
option: '--userIds [userIds]'
|
|
165
|
+
}, {
|
|
166
|
+
option: '--entraGroupIds [entraGroupIds]'
|
|
155
167
|
}, {
|
|
156
168
|
option: '--aadGroupIds [aadGroupIds]'
|
|
169
|
+
}, {
|
|
170
|
+
option: '--entraGroupNames [entraGroupNames]'
|
|
157
171
|
}, {
|
|
158
172
|
option: '--aadGroupNames [aadGroupNames]'
|
|
159
173
|
});
|
|
@@ -176,13 +190,16 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
|
|
|
176
190
|
if (args.options.emails && args.options.emails.split(',').some(e => !validation.isValidUserPrincipalName(e))) {
|
|
177
191
|
return `${args.options.emails} contains one or more invalid email addresses`;
|
|
178
192
|
}
|
|
193
|
+
if (args.options.entraGroupIds && args.options.entraGroupIds.split(',').some(e => !validation.isValidGuid(e))) {
|
|
194
|
+
return `${args.options.entraGroupIds} contains one or more invalid GUIDs`;
|
|
195
|
+
}
|
|
179
196
|
if (args.options.aadGroupIds && args.options.aadGroupIds.split(',').some(e => !validation.isValidGuid(e))) {
|
|
180
197
|
return `${args.options.aadGroupIds} contains one or more invalid GUIDs`;
|
|
181
198
|
}
|
|
182
199
|
return true;
|
|
183
200
|
});
|
|
184
201
|
}, _SpoGroupMemberAddCommand_initOptionSets = function _SpoGroupMemberAddCommand_initOptionSets() {
|
|
185
|
-
this.optionSets.push({ options: ['groupId', 'groupName'] }, { options: ['userNames', 'emails', 'userIds', 'aadGroupIds', 'aadGroupNames'] });
|
|
202
|
+
this.optionSets.push({ options: ['groupId', 'groupName'] }, { options: ['userNames', 'emails', 'userIds', 'entraGroupIds', 'aadGroupIds', 'entraGroupNames', 'aadGroupNames'] });
|
|
186
203
|
};
|
|
187
204
|
export default new SpoGroupMemberAddCommand();
|
|
188
205
|
//# sourceMappingURL=group-member-add.js.map
|
|
@@ -45,6 +45,14 @@ class SpoGroupMemberRemoveCommand extends SpoCommand {
|
|
|
45
45
|
return userOutput.userPrincipalName;
|
|
46
46
|
}
|
|
47
47
|
async commandAction(logger, args) {
|
|
48
|
+
if (args.options.aadGroupId) {
|
|
49
|
+
args.options.entraGroupId = args.options.aadGroupId;
|
|
50
|
+
this.warn(logger, `Option 'aadGroupId' is deprecated. Please use 'entraGroupId' instead`);
|
|
51
|
+
}
|
|
52
|
+
if (args.options.aadGroupName) {
|
|
53
|
+
args.options.entraGroupName = args.options.aadGroupName;
|
|
54
|
+
this.warn(logger, `Option 'aadGroupName' is deprecated. Please use 'entraGroupName' instead`);
|
|
55
|
+
}
|
|
48
56
|
if (args.options.force) {
|
|
49
57
|
if (this.debug) {
|
|
50
58
|
await logger.logToStderr('Confirmation bypassed by entering confirm option. Removing the user from SharePoint Group...');
|
|
@@ -52,7 +60,7 @@ class SpoGroupMemberRemoveCommand extends SpoCommand {
|
|
|
52
60
|
await this.removeUserfromSPGroup(logger, args);
|
|
53
61
|
}
|
|
54
62
|
else {
|
|
55
|
-
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove user ${args.options.userName || args.options.userId || args.options.email || args.options.
|
|
63
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove user ${args.options.userName || args.options.userId || args.options.email || args.options.entraGroupId || args.options.entraGroupName} from the SharePoint group?` });
|
|
56
64
|
if (result) {
|
|
57
65
|
await this.removeUserfromSPGroup(logger, args);
|
|
58
66
|
}
|
|
@@ -60,7 +68,7 @@ class SpoGroupMemberRemoveCommand extends SpoCommand {
|
|
|
60
68
|
}
|
|
61
69
|
async removeUserfromSPGroup(logger, args) {
|
|
62
70
|
if (this.verbose) {
|
|
63
|
-
await logger.logToStderr(`Removing User ${args.options.userName || args.options.email || args.options.userId || args.options.
|
|
71
|
+
await logger.logToStderr(`Removing User ${args.options.userName || args.options.email || args.options.userId || args.options.entraGroupId || args.options.entraGroupName} from Group: ${args.options.groupId || args.options.groupName}`);
|
|
64
72
|
}
|
|
65
73
|
let requestUrl = `${args.options.webUrl}/_api/web/sitegroups/${args.options.groupId
|
|
66
74
|
? `GetById('${args.options.groupId}')`
|
|
@@ -74,8 +82,8 @@ class SpoGroupMemberRemoveCommand extends SpoCommand {
|
|
|
74
82
|
requestUrl += `/users/removeByLoginName(@LoginName)?@LoginName='${formatting.encodeQueryParameter(loginName)}'`;
|
|
75
83
|
}
|
|
76
84
|
else {
|
|
77
|
-
const
|
|
78
|
-
requestUrl += `/users/RemoveById(${
|
|
85
|
+
const entraGroupId = await this.getGroupId(args);
|
|
86
|
+
requestUrl += `/users/RemoveById(${entraGroupId})`;
|
|
79
87
|
}
|
|
80
88
|
const requestOptions = {
|
|
81
89
|
url: requestUrl,
|
|
@@ -107,14 +115,14 @@ class SpoGroupMemberRemoveCommand extends SpoCommand {
|
|
|
107
115
|
const output = await cli.executeCommandWithOutput(SpoGroupMemberListCommand, { options: { ...options, _: [] } });
|
|
108
116
|
const getGroupMemberListOutput = JSON.parse(output.stdout);
|
|
109
117
|
let foundGroups;
|
|
110
|
-
if (args.options.
|
|
111
|
-
foundGroups = getGroupMemberListOutput.filter((x) => { return x.LoginName.indexOf(args.options.
|
|
118
|
+
if (args.options.entraGroupId) {
|
|
119
|
+
foundGroups = getGroupMemberListOutput.filter((x) => { return x.LoginName.indexOf(args.options.entraGroupId) > -1 && (x.LoginName.indexOf("c:0o.c|federateddirectoryclaimprovider|") === 0 || x.LoginName.indexOf("c:0t.c|tenant|") === 0); });
|
|
112
120
|
}
|
|
113
121
|
else {
|
|
114
|
-
foundGroups = getGroupMemberListOutput.filter((x) => { return x.Title === args.options.
|
|
122
|
+
foundGroups = getGroupMemberListOutput.filter((x) => { return x.Title === args.options.entraGroupName && (x.LoginName.indexOf("c:0o.c|federateddirectoryclaimprovider|") === 0 || x.LoginName.indexOf("c:0t.c|tenant|") === 0); });
|
|
115
123
|
}
|
|
116
124
|
if (foundGroups.length === 0) {
|
|
117
|
-
throw `The Azure AD group ${args.options.
|
|
125
|
+
throw `The Azure AD group ${args.options.entraGroupId || args.options.entraGroupName} is not found in SharePoint group ${args.options.groupId || args.options.groupName}`;
|
|
118
126
|
}
|
|
119
127
|
return foundGroups[0].Id;
|
|
120
128
|
}
|
|
@@ -127,8 +135,10 @@ _SpoGroupMemberRemoveCommand_instances = new WeakSet(), _SpoGroupMemberRemoveCom
|
|
|
127
135
|
userName: (!(!args.options.userName)).toString(),
|
|
128
136
|
email: (!(!args.options.email)).toString(),
|
|
129
137
|
userId: (!(!args.options.userId)).toString(),
|
|
138
|
+
entraGroupId: (!(!args.options.entraGroupId)).toString(),
|
|
130
139
|
aadGroupId: (!(!args.options.groupId)).toString(),
|
|
131
|
-
|
|
140
|
+
entraGroupName: (!(!args.options.entraGroupName)).toString(),
|
|
141
|
+
aadGroupName: (!(!args.options.aadGroupName)).toString(),
|
|
132
142
|
force: (!(!args.options.force)).toString()
|
|
133
143
|
});
|
|
134
144
|
});
|
|
@@ -145,8 +155,12 @@ _SpoGroupMemberRemoveCommand_instances = new WeakSet(), _SpoGroupMemberRemoveCom
|
|
|
145
155
|
option: '--email [email]'
|
|
146
156
|
}, {
|
|
147
157
|
option: '--userId [userId]'
|
|
158
|
+
}, {
|
|
159
|
+
option: '--entraGroupId [entraGroupId]'
|
|
148
160
|
}, {
|
|
149
161
|
option: '--aadGroupId [aadGroupId]'
|
|
162
|
+
}, {
|
|
163
|
+
option: '--entraGroupName [entraGroupName]'
|
|
150
164
|
}, {
|
|
151
165
|
option: '--aadGroupName [aadGroupName]'
|
|
152
166
|
}, {
|
|
@@ -166,13 +180,16 @@ _SpoGroupMemberRemoveCommand_instances = new WeakSet(), _SpoGroupMemberRemoveCom
|
|
|
166
180
|
if (args.options.email && !validation.isValidUserPrincipalName(args.options.email)) {
|
|
167
181
|
return `${args.options.email} is not a valid email`;
|
|
168
182
|
}
|
|
183
|
+
if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
|
|
184
|
+
return `${args.options.entraGroupId} is not a valid GUID`;
|
|
185
|
+
}
|
|
169
186
|
if (args.options.aadGroupId && !validation.isValidGuid(args.options.aadGroupId)) {
|
|
170
187
|
return `${args.options.aadGroupId} is not a valid GUID`;
|
|
171
188
|
}
|
|
172
189
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
173
190
|
});
|
|
174
191
|
}, _SpoGroupMemberRemoveCommand_initOptionSets = function _SpoGroupMemberRemoveCommand_initOptionSets() {
|
|
175
|
-
this.optionSets.push({ options: ['groupName', 'groupId'] }, { options: ['userName', 'email', 'userId', 'aadGroupId', 'aadGroupName'] });
|
|
192
|
+
this.optionSets.push({ options: ['groupName', 'groupId'] }, { options: ['userName', 'email', 'userId', 'entraGroupId', 'aadGroupId', 'entraGroupName', 'aadGroupName'] });
|
|
176
193
|
};
|
|
177
194
|
export default new SpoGroupMemberRemoveCommand();
|
|
178
195
|
//# sourceMappingURL=group-member-remove.js.map
|
|
@@ -25,12 +25,16 @@ class SpoUserEnsureCommand extends SpoCommand {
|
|
|
25
25
|
__classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptionSets).call(this);
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
|
+
if (args.options.aadId) {
|
|
29
|
+
args.options.entraId = args.options.aadId;
|
|
30
|
+
this.warn(logger, `Option 'aadId' is deprecated. Please use 'entraId' instead`);
|
|
31
|
+
}
|
|
28
32
|
if (this.verbose) {
|
|
29
|
-
await logger.logToStderr(`Ensuring user ${args.options.
|
|
33
|
+
await logger.logToStderr(`Ensuring user ${args.options.entraId || args.options.userName} at site ${args.options.webUrl}`);
|
|
30
34
|
}
|
|
31
35
|
try {
|
|
32
36
|
const requestBody = {
|
|
33
|
-
logonName: args.options.userName || await this.getUpnByUserId(args.options.
|
|
37
|
+
logonName: args.options.userName || await this.getUpnByUserId(args.options.entraId, logger)
|
|
34
38
|
};
|
|
35
39
|
const requestOptions = {
|
|
36
40
|
url: `${args.options.webUrl}/_api/web/ensureuser`,
|
|
@@ -47,16 +51,17 @@ class SpoUserEnsureCommand extends SpoCommand {
|
|
|
47
51
|
this.handleRejectedODataJsonPromise(err);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
async getUpnByUserId(
|
|
54
|
+
async getUpnByUserId(entraId, logger) {
|
|
51
55
|
if (this.verbose) {
|
|
52
|
-
await logger.logToStderr(`Retrieving user principal name for user with id ${
|
|
56
|
+
await logger.logToStderr(`Retrieving user principal name for user with id ${entraId}`);
|
|
53
57
|
}
|
|
54
|
-
return await aadUser.getUpnByUserId(
|
|
58
|
+
return await aadUser.getUpnByUserId(entraId);
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
_SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelemetry = function _SpoUserEnsureCommand_initTelemetry() {
|
|
58
62
|
this.telemetry.push((args) => {
|
|
59
63
|
Object.assign(this.telemetryProperties, {
|
|
64
|
+
entraId: typeof args.options.entraId !== 'undefined',
|
|
60
65
|
aadId: typeof args.options.aadId !== 'undefined',
|
|
61
66
|
userName: typeof args.options.userName !== 'undefined'
|
|
62
67
|
});
|
|
@@ -64,6 +69,8 @@ _SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelem
|
|
|
64
69
|
}, _SpoUserEnsureCommand_initOptions = function _SpoUserEnsureCommand_initOptions() {
|
|
65
70
|
this.options.unshift({
|
|
66
71
|
option: '-u, --webUrl <webUrl>'
|
|
72
|
+
}, {
|
|
73
|
+
option: '--entraId [entraId]'
|
|
67
74
|
}, {
|
|
68
75
|
option: '--aadId [aadId]'
|
|
69
76
|
}, {
|
|
@@ -75,6 +82,9 @@ _SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelem
|
|
|
75
82
|
if (isValidSharePointUrl !== true) {
|
|
76
83
|
return isValidSharePointUrl;
|
|
77
84
|
}
|
|
85
|
+
if (args.options.entraId && !validation.isValidGuid(args.options.entraId)) {
|
|
86
|
+
return `${args.options.entraId} is not a valid GUID.`;
|
|
87
|
+
}
|
|
78
88
|
if (args.options.aadId && !validation.isValidGuid(args.options.aadId)) {
|
|
79
89
|
return `${args.options.aadId} is not a valid GUID.`;
|
|
80
90
|
}
|
|
@@ -84,7 +94,7 @@ _SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelem
|
|
|
84
94
|
return true;
|
|
85
95
|
});
|
|
86
96
|
}, _SpoUserEnsureCommand_initOptionSets = function _SpoUserEnsureCommand_initOptionSets() {
|
|
87
|
-
this.optionSets.push({ options: ['aadId', 'userName'] });
|
|
97
|
+
this.optionSets.push({ options: ['entraId', 'aadId', 'userName'] });
|
|
88
98
|
};
|
|
89
99
|
export default new SpoUserEnsureCommand();
|
|
90
100
|
//# sourceMappingURL=user-ensure.js.map
|