@pnp/cli-microsoft365 10.8.0-beta.04e20e9 → 10.8.0-beta.a51d886
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +82 -22
- package/dist/m365/commands/login.js +1 -1
- package/dist/m365/commands/setup.js +1 -2
- package/dist/m365/spe/commands/container/container-permission-list.js +52 -0
- package/dist/m365/spe/commands.js +1 -0
- package/dist/m365/spo/commands/page/page-section-add.js +20 -23
- package/dist/m365/spo/commands/site/site-set.js +3 -22
- package/dist/m365/teams/commands/app/app-install.js +3 -9
- package/dist/m365/viva/commands/connections/connections-app-create.js +4 -12
- package/dist/utils/entraGroup.js +7 -1
- package/dist/utils/entraUser.js +7 -1
- package/dist/utils/spo.js +1 -1
- package/docs/docs/cmd/spe/container/container-permission-list.mdx +90 -0
- package/docs/docs/cmd/spo/field/field-get.mdx +0 -1
- package/npm-shrinkwrap.json +894 -477
- package/package.json +10 -10
package/dist/Auth.js
CHANGED
|
@@ -562,19 +562,93 @@ export class Auth {
|
|
|
562
562
|
if (debug) {
|
|
563
563
|
await logger.logToStderr('Trying to retrieve access token using federated identity...');
|
|
564
564
|
}
|
|
565
|
-
if (
|
|
566
|
-
|
|
565
|
+
if (process.env.ACTIONS_ID_TOKEN_REQUEST_URL && process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN) {
|
|
566
|
+
if (debug) {
|
|
567
|
+
await logger.logToStderr('ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN env variables found. The context is GitHub Actions...');
|
|
568
|
+
}
|
|
569
|
+
const federationToken = await this.getFederationTokenFromGithub(logger, debug);
|
|
570
|
+
return this.getAccessTokenWithFederatedToken(resource, federationToken, logger, debug);
|
|
571
|
+
}
|
|
572
|
+
else if (process.env.SYSTEM_OIDCREQUESTURI) {
|
|
573
|
+
if (debug) {
|
|
574
|
+
await logger.logToStderr('SYSTEM_OIDCREQUESTURI env variable found. The context is Azure DevOps...');
|
|
575
|
+
}
|
|
576
|
+
if (!process.env.SYSTEM_ACCESSTOKEN) {
|
|
577
|
+
throw new CommandError(`The SYSTEM_ACCESSTOKEN environment variable is not available. Please check the Azure DevOps pipeline task configuration. It should contain 'SYSTEM_ACCESSTOKEN: $(System.AccessToken)' in the env section.`);
|
|
578
|
+
}
|
|
579
|
+
const serviceConnectionId = process.env.AZURESUBSCRIPTION_SERVICE_CONNECTION_ID;
|
|
580
|
+
const serviceConnectionAppId = process.env.AZURESUBSCRIPTION_CLIENT_ID;
|
|
581
|
+
const serviceConnectionTenantId = process.env.AZURESUBSCRIPTION_TENANT_ID;
|
|
582
|
+
const useServiceConnection = serviceConnectionId && serviceConnectionAppId && serviceConnectionTenantId;
|
|
583
|
+
if (!useServiceConnection) {
|
|
584
|
+
if (debug) {
|
|
585
|
+
await logger.logToStderr('Not using a service connection. Run this command in an AzurePowerShell task to be able to use a service connection.');
|
|
586
|
+
}
|
|
587
|
+
if (!this.connection.appId || this.connection.tenant === 'common') {
|
|
588
|
+
throw new CommandError('The appId and tenant parameters are required when not using a service connection.');
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
if (debug) {
|
|
593
|
+
if (this.connection.appId || this.connection.tenant !== 'common') {
|
|
594
|
+
await logger.logToStderr('When using a service connection, the appId and tenant values are updated to the values of the service connection.');
|
|
595
|
+
}
|
|
596
|
+
await logger.logToStderr(`Using service connection '${serviceConnectionId}' with app Id '${serviceConnectionAppId}' and tenant Id '${serviceConnectionTenantId}'...`);
|
|
597
|
+
}
|
|
598
|
+
this.connection.appId = serviceConnectionAppId;
|
|
599
|
+
this.connection.tenant = serviceConnectionTenantId;
|
|
600
|
+
}
|
|
601
|
+
const federationToken = await this.getFederationTokenFromAzureDevOps(logger, debug, serviceConnectionId);
|
|
602
|
+
return this.getAccessTokenWithFederatedToken(resource, federationToken, logger, debug);
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
throw new CommandError('Federated identity is currently only supported in GitHub Actions and Azure DevOps.');
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
async getFederationTokenFromGithub(logger, debug) {
|
|
609
|
+
if (debug) {
|
|
610
|
+
await logger.logToStderr('Retrieving GitHub federation token...');
|
|
611
|
+
}
|
|
612
|
+
const requestOptions = {
|
|
613
|
+
url: `${process.env.ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${encodeURIComponent('api://AzureADTokenExchange')}`,
|
|
614
|
+
headers: {
|
|
615
|
+
Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`,
|
|
616
|
+
Accept: 'application/json',
|
|
617
|
+
'x-anonymous': true
|
|
618
|
+
},
|
|
619
|
+
responseType: 'json'
|
|
620
|
+
};
|
|
621
|
+
const accessTokenResponse = await request.get(requestOptions);
|
|
622
|
+
return accessTokenResponse.value;
|
|
623
|
+
}
|
|
624
|
+
async getFederationTokenFromAzureDevOps(logger, debug, serviceConnectionId) {
|
|
625
|
+
if (debug) {
|
|
626
|
+
await logger.logToStderr('Retrieving Azure DevOps federation token...');
|
|
567
627
|
}
|
|
628
|
+
const urlSuffix = serviceConnectionId ? `&serviceConnectionId=${serviceConnectionId}` : '';
|
|
629
|
+
const requestOptions = {
|
|
630
|
+
url: `${process.env.SYSTEM_OIDCREQUESTURI}?api-version=7.1${urlSuffix}`,
|
|
631
|
+
headers: {
|
|
632
|
+
Authorization: `Bearer ${process.env.SYSTEM_ACCESSTOKEN}`,
|
|
633
|
+
Accept: 'application/json',
|
|
634
|
+
'Content-Type': 'application/json',
|
|
635
|
+
'x-anonymous': true
|
|
636
|
+
},
|
|
637
|
+
responseType: 'json'
|
|
638
|
+
};
|
|
639
|
+
const accessTokenResponse = await request.post(requestOptions);
|
|
640
|
+
return accessTokenResponse.oidcToken;
|
|
641
|
+
}
|
|
642
|
+
async getAccessTokenWithFederatedToken(resource, federatedToken, logger, debug) {
|
|
568
643
|
if (debug) {
|
|
569
|
-
await logger.logToStderr('
|
|
644
|
+
await logger.logToStderr('Retrieving Entra ID Access Token with federated token...');
|
|
570
645
|
}
|
|
571
|
-
const federationToken = await this.getFederationTokenFromGithub(logger, debug);
|
|
572
646
|
const queryParams = [
|
|
573
647
|
'grant_type=client_credentials',
|
|
574
648
|
`scope=${encodeURIComponent(`${resource}/.default`)}`,
|
|
575
649
|
`client_id=${this.connection.appId}`,
|
|
576
650
|
`client_assertion_type=${encodeURIComponent('urn:ietf:params:oauth:client-assertion-type:jwt-bearer')}`,
|
|
577
|
-
`client_assertion=${
|
|
651
|
+
`client_assertion=${federatedToken}`
|
|
578
652
|
];
|
|
579
653
|
const requestOptions = {
|
|
580
654
|
url: `https://login.microsoftonline.com/${this.connection.tenant}/oauth2/v2.0/token`,
|
|
@@ -587,27 +661,13 @@ export class Auth {
|
|
|
587
661
|
responseType: 'json'
|
|
588
662
|
};
|
|
589
663
|
const accessTokenResponse = await request.post(requestOptions);
|
|
664
|
+
const expiresIn = parseInt(accessTokenResponse.expires_in) * 1000;
|
|
665
|
+
const now = new Date();
|
|
590
666
|
return {
|
|
591
667
|
accessToken: accessTokenResponse.access_token,
|
|
592
|
-
expiresOn: new Date(
|
|
668
|
+
expiresOn: new Date(now.getTime() + expiresIn)
|
|
593
669
|
};
|
|
594
670
|
}
|
|
595
|
-
async getFederationTokenFromGithub(logger, debug) {
|
|
596
|
-
if (debug) {
|
|
597
|
-
await logger.logToStderr('Retrieving GitHub federation token...');
|
|
598
|
-
}
|
|
599
|
-
const requestOptions = {
|
|
600
|
-
url: `${process.env.ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${encodeURIComponent('api://AzureADTokenExchange')}`,
|
|
601
|
-
headers: {
|
|
602
|
-
Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`,
|
|
603
|
-
accept: 'application/json',
|
|
604
|
-
'x-anonymous': true
|
|
605
|
-
},
|
|
606
|
-
responseType: 'json'
|
|
607
|
-
};
|
|
608
|
-
const accessTokenResponse = await request.get(requestOptions);
|
|
609
|
-
return accessTokenResponse.value;
|
|
610
|
-
}
|
|
611
671
|
async ensureAccessTokenWithSecret(resource, logger, debug, fetchNew) {
|
|
612
672
|
this.clientApplication = await this.getConfidentialClient(logger, debug, undefined, undefined, this.connection.secret);
|
|
613
673
|
return this.clientApplication.acquireTokenByClientCredential({
|
|
@@ -37,7 +37,7 @@ class LoginCommand extends Command {
|
|
|
37
37
|
}
|
|
38
38
|
getRefinedSchema(schema) {
|
|
39
39
|
return schema
|
|
40
|
-
.refine(options => typeof options.appId !== 'undefined' || cli.getClientId() || options.authType === 'identity', {
|
|
40
|
+
.refine(options => typeof options.appId !== 'undefined' || cli.getClientId() || options.authType === 'identity' || options.authType === 'federatedIdentity', {
|
|
41
41
|
message: `appId is required. TIP: use the "m365 setup" command to configure the default appId.`,
|
|
42
42
|
path: ['appId']
|
|
43
43
|
})
|
|
@@ -18,7 +18,6 @@ import { validation } from '../../utils/validation.js';
|
|
|
18
18
|
import AnonymousCommand from '../base/AnonymousCommand.js';
|
|
19
19
|
import commands from './commands.js';
|
|
20
20
|
import { interactivePreset, powerShellPreset, scriptingPreset } from './setupPresets.js';
|
|
21
|
-
import { optionsUtils } from '../../utils/optionsUtils.js';
|
|
22
21
|
export var CliUsageMode;
|
|
23
22
|
(function (CliUsageMode) {
|
|
24
23
|
CliUsageMode["Interactively"] = "interactively";
|
|
@@ -228,7 +227,7 @@ class SetupCommand extends AnonymousCommand {
|
|
|
228
227
|
});
|
|
229
228
|
const appInfo = await entraApp.createAppRegistration({
|
|
230
229
|
options,
|
|
231
|
-
unknownOptions:
|
|
230
|
+
unknownOptions: {},
|
|
232
231
|
apis,
|
|
233
232
|
logger,
|
|
234
233
|
verbose: this.verbose,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cli } from '../../../../cli/cli.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { zod } from '../../../../utils/zod.js';
|
|
4
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
7
|
+
import { odata } from '../../../../utils/odata.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
const options = globalOptionsZod
|
|
10
|
+
.extend({
|
|
11
|
+
containerId: zod.alias('i', z.string())
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
14
|
+
class SpeContainerPermissionListCommand extends GraphCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.CONTAINER_PERMISSION_LIST;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Lists permissions of a SharePoint Embedded Container';
|
|
20
|
+
}
|
|
21
|
+
defaultProperties() {
|
|
22
|
+
return ['id', 'userPrincipalName', 'roles'];
|
|
23
|
+
}
|
|
24
|
+
get schema() {
|
|
25
|
+
return options;
|
|
26
|
+
}
|
|
27
|
+
async commandAction(logger, args) {
|
|
28
|
+
try {
|
|
29
|
+
if (this.verbose) {
|
|
30
|
+
await logger.logToStderr(`Retrieving permissions of a SharePoint Embedded Container with id '${args.options.containerId}'...`);
|
|
31
|
+
}
|
|
32
|
+
const containerPermission = await odata.getAllItems(`${this.resource}/v1.0/storage/fileStorage/containers/${formatting.encodeQueryParameter(args.options.containerId)}/permissions`);
|
|
33
|
+
if (!cli.shouldTrimOutput(args.options.output)) {
|
|
34
|
+
await logger.log(containerPermission);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
await logger.log(containerPermission.map(i => {
|
|
38
|
+
return {
|
|
39
|
+
id: i.id,
|
|
40
|
+
roles: i.roles.join(','),
|
|
41
|
+
userPrincipalName: i.grantedToV2.user.userPrincipalName
|
|
42
|
+
};
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
this.handleRejectedODataJsonPromise(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export default new SpeContainerPermissionListCommand();
|
|
52
|
+
//# sourceMappingURL=container-permission-list.js.map
|
|
@@ -3,6 +3,7 @@ export default {
|
|
|
3
3
|
CONTAINER_ACTIVATE: `${prefix} container activate`,
|
|
4
4
|
CONTAINER_GET: `${prefix} container get`,
|
|
5
5
|
CONTAINER_LIST: `${prefix} container list`,
|
|
6
|
+
CONTAINER_PERMISSION_LIST: `${prefix} container permission list`,
|
|
6
7
|
CONTAINERTYPE_ADD: `${prefix} containertype add`,
|
|
7
8
|
CONTAINERTYPE_GET: `${prefix} containertype get`,
|
|
8
9
|
CONTAINERTYPE_LIST: `${prefix} containertype list`
|
|
@@ -59,19 +59,25 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
59
59
|
};
|
|
60
60
|
await request.post(requestOptions);
|
|
61
61
|
}
|
|
62
|
-
// get columns
|
|
63
|
-
const columns = canvasContent
|
|
64
|
-
.filter(c => typeof c.controlType === 'undefined');
|
|
65
62
|
// get unique zoneIndex values given each section can have 1 or more
|
|
66
63
|
// columns each assigned to the zoneIndex of the corresponding section
|
|
67
|
-
const zoneIndices =
|
|
64
|
+
const zoneIndices = canvasContent
|
|
65
|
+
// Exclude the vertical section
|
|
66
|
+
.filter(c => c.position)
|
|
68
67
|
.map(c => c.position.zoneIndex)
|
|
69
68
|
.filter((value, index, array) => {
|
|
70
69
|
return array.indexOf(value) === index;
|
|
71
70
|
})
|
|
72
|
-
.sort();
|
|
73
|
-
// zoneIndex
|
|
74
|
-
|
|
71
|
+
.sort((a, b) => a - b);
|
|
72
|
+
// Add a new zoneIndex at the end of the array
|
|
73
|
+
zoneIndices.push(zoneIndices.length > 0 ? zoneIndices[zoneIndices.length - 1] + 1 : 1);
|
|
74
|
+
// get section number. if not specified, get the last section
|
|
75
|
+
let section = args.options.order || zoneIndices.length;
|
|
76
|
+
if (section > zoneIndices.length) {
|
|
77
|
+
section = zoneIndices.length;
|
|
78
|
+
}
|
|
79
|
+
// zoneIndex that represents the section where the web part should be added
|
|
80
|
+
const zoneIndex = zoneIndices[section - 1];
|
|
75
81
|
let zoneId;
|
|
76
82
|
let backgroundControlToAdd = undefined;
|
|
77
83
|
if (args.options.zoneEmphasis && ['image', 'gradient'].includes(args.options.zoneEmphasis.toLowerCase())) {
|
|
@@ -83,11 +89,17 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
83
89
|
canvasContent.push(backgroundControlToAdd);
|
|
84
90
|
}
|
|
85
91
|
}
|
|
92
|
+
// Increment the zoneIndex of all columns that are greater than or equal to the new zoneIndex
|
|
93
|
+
canvasContent.forEach((c) => {
|
|
94
|
+
if (c.position && c.position.zoneIndex >= zoneIndex) {
|
|
95
|
+
c.position.zoneIndex += 1;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
86
98
|
// get the list of columns to insert based on the selected template
|
|
87
99
|
const columnsToAdd = this.getColumns(zoneIndex, args, zoneId);
|
|
88
100
|
// insert the column in the right place in the array so that
|
|
89
101
|
// it stays sorted ascending by zoneIndex
|
|
90
|
-
let pos = canvasContent.findIndex(c =>
|
|
102
|
+
let pos = canvasContent.findIndex(c => c.position && c.position.zoneIndex >= zoneIndex);
|
|
91
103
|
if (pos === -1) {
|
|
92
104
|
pos = canvasContent.length - 1;
|
|
93
105
|
}
|
|
@@ -109,21 +121,6 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
109
121
|
this.handleRejectedODataJsonPromise(err);
|
|
110
122
|
}
|
|
111
123
|
}
|
|
112
|
-
getSectionIndex(zoneIndices, order) {
|
|
113
|
-
// zoneIndex of the first column on the page
|
|
114
|
-
const minIndex = zoneIndices.length === 0 ? 0 : zoneIndices[0];
|
|
115
|
-
// zoneIndex of the last column on the page
|
|
116
|
-
const maxIndex = zoneIndices.length === 0 ? 0 : zoneIndices[zoneIndices.length - 1];
|
|
117
|
-
if (!order || order > zoneIndices.length) {
|
|
118
|
-
// no order specified, add section to the end
|
|
119
|
-
return maxIndex === 0 ? 1 : maxIndex * 2;
|
|
120
|
-
}
|
|
121
|
-
// add to the beginning
|
|
122
|
-
if (order === 1) {
|
|
123
|
-
return minIndex / 2;
|
|
124
|
-
}
|
|
125
|
-
return zoneIndices[order - 2] + ((zoneIndices[order - 1] - zoneIndices[order - 2]) / 2);
|
|
126
|
-
}
|
|
127
124
|
getColumns(zoneIndex, args, zoneId) {
|
|
128
125
|
const columns = [];
|
|
129
126
|
let sectionIndex = 1;
|
|
@@ -4,19 +4,16 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoSiteSetCommand_instances, _SpoSiteSetCommand_initTelemetry, _SpoSiteSetCommand_initOptions, _SpoSiteSetCommand_initValidators, _SpoSiteSetCommand_initTypes;
|
|
7
|
-
import { cli } from '../../../../cli/cli.js';
|
|
8
|
-
import { CommandError } from '../../../../Command.js';
|
|
9
7
|
import config from '../../../../config.js';
|
|
10
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
11
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
12
11
|
import { spo } from '../../../../utils/spo.js';
|
|
13
12
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
14
13
|
import { validation } from '../../../../utils/validation.js';
|
|
15
|
-
import entraM365GroupSetCommand from '../../../entra/commands/m365group/m365group-set.js';
|
|
16
14
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
17
15
|
import commands from '../../commands.js';
|
|
18
16
|
import { SharingCapabilities } from '../site/SharingCapabilities.js';
|
|
19
|
-
import spoSiteDesignApplyCommand from '../sitedesign/sitedesign-apply.js';
|
|
20
17
|
import { FlowsPolicy } from './FlowsPolicy.js';
|
|
21
18
|
import { setTimeout } from 'timers/promises';
|
|
22
19
|
class SpoSiteSetCommand extends SpoCommand {
|
|
@@ -55,9 +52,6 @@ class SpoSiteSetCommand extends SpoCommand {
|
|
|
55
52
|
await this.waitForSiteUpdateCompletion(logger, args, lockState);
|
|
56
53
|
}
|
|
57
54
|
catch (err) {
|
|
58
|
-
if (err instanceof CommandError) {
|
|
59
|
-
err = err.message;
|
|
60
|
-
}
|
|
61
55
|
this.handleRejectedPromise(err);
|
|
62
56
|
}
|
|
63
57
|
}
|
|
@@ -233,13 +227,7 @@ class SpoSiteSetCommand extends SpoCommand {
|
|
|
233
227
|
promises.push(request.post(requestOptions));
|
|
234
228
|
}
|
|
235
229
|
if (typeof args.options.isPublic !== 'undefined') {
|
|
236
|
-
|
|
237
|
-
id: this.groupId,
|
|
238
|
-
isPrivate: (args.options.isPublic === false),
|
|
239
|
-
debug: this.debug,
|
|
240
|
-
verbose: this.verbose
|
|
241
|
-
};
|
|
242
|
-
promises.push(cli.executeCommand(entraM365GroupSetCommand, { options: { ...commandOptions, _: [] } }));
|
|
230
|
+
promises.push(entraGroup.setGroup(this.groupId, (args.options.isPublic === false), undefined, undefined, logger, this.verbose));
|
|
243
231
|
}
|
|
244
232
|
if (args.options.description) {
|
|
245
233
|
promises.push(this.setGroupifiedSiteDescription(args.options.description));
|
|
@@ -383,14 +371,7 @@ class SpoSiteSetCommand extends SpoCommand {
|
|
|
383
371
|
if (typeof args.options.siteDesignId === 'undefined') {
|
|
384
372
|
return;
|
|
385
373
|
}
|
|
386
|
-
|
|
387
|
-
webUrl: args.options.url,
|
|
388
|
-
id: args.options.siteDesignId,
|
|
389
|
-
asTask: false,
|
|
390
|
-
debug: this.debug,
|
|
391
|
-
verbose: this.verbose
|
|
392
|
-
};
|
|
393
|
-
return cli.executeCommand(spoSiteDesignApplyCommand, { options: { ...options, _: [] } });
|
|
374
|
+
return spo.applySiteDesign(args.options.url, args.options.siteDesignId, logger, this.verbose);
|
|
394
375
|
}
|
|
395
376
|
async loadSiteIds(siteUrl, logger) {
|
|
396
377
|
if (this.debug) {
|
|
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _TeamsAppInstallCommand_instances, _TeamsAppInstallCommand_initTelemetry, _TeamsAppInstallCommand_initOptions, _TeamsAppInstallCommand_initValidators, _TeamsAppInstallCommand_initOptionSets;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
9
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
11
|
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import entraUserGetCommand from '../../../entra/commands/user/user-get.js';
|
|
12
12
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
14
|
class TeamsAppInstallCommand extends GraphCommand {
|
|
@@ -63,16 +63,10 @@ class TeamsAppInstallCommand extends GraphCommand {
|
|
|
63
63
|
if (this.verbose) {
|
|
64
64
|
await logger.logToStderr(`Checking if user ${args.options.userId} exists...`);
|
|
65
65
|
}
|
|
66
|
-
const options = {
|
|
67
|
-
id: args.options.userId,
|
|
68
|
-
output: 'json',
|
|
69
|
-
debug: args.options.debug,
|
|
70
|
-
verbose: args.options.verbose
|
|
71
|
-
};
|
|
72
66
|
try {
|
|
73
|
-
const res = await
|
|
67
|
+
const res = await entraUser.getUpnByUserId(args.options.userId, logger, this.verbose);
|
|
74
68
|
if (this.verbose) {
|
|
75
|
-
await logger.logToStderr(res
|
|
69
|
+
await logger.logToStderr(res);
|
|
76
70
|
}
|
|
77
71
|
return true;
|
|
78
72
|
}
|
|
@@ -8,10 +8,9 @@ import AdmZip from 'adm-zip';
|
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import { v4 } from 'uuid';
|
|
11
|
-
import { cli } from '../../../../cli/cli.js';
|
|
12
11
|
import AnonymousCommand from '../../../base/AnonymousCommand.js';
|
|
13
|
-
import spoWebGetCommand from '../../../spo/commands/web/web-get.js';
|
|
14
12
|
import commands from '../../commands.js';
|
|
13
|
+
import { spo } from '../../../../utils/spo.js';
|
|
15
14
|
class VivaConnectionsAppCreateCommand extends AnonymousCommand {
|
|
16
15
|
get name() {
|
|
17
16
|
return commands.CONNECTIONS_APP_CREATE;
|
|
@@ -27,14 +26,13 @@ class VivaConnectionsAppCreateCommand extends AnonymousCommand {
|
|
|
27
26
|
}
|
|
28
27
|
async commandAction(logger, args) {
|
|
29
28
|
try {
|
|
30
|
-
const
|
|
29
|
+
const web = await this.getWeb(args, logger);
|
|
31
30
|
if (this.debug) {
|
|
32
|
-
await logger.logToStderr(
|
|
31
|
+
await logger.logToStderr(web);
|
|
33
32
|
}
|
|
34
33
|
if (this.verbose) {
|
|
35
34
|
await logger.logToStderr(`Site found at ${args.options.portalUrl}. Checking if it's a communication site...`);
|
|
36
35
|
}
|
|
37
|
-
const web = JSON.parse(getWebOutput.stdout);
|
|
38
36
|
if (web.WebTemplate !== 'SITEPAGEPUBLISHING' ||
|
|
39
37
|
web.Configuration !== 0) {
|
|
40
38
|
throw `Site ${args.options.portalUrl} is not a Communication Site. Please specify a different site and try again.`;
|
|
@@ -137,13 +135,7 @@ class VivaConnectionsAppCreateCommand extends AnonymousCommand {
|
|
|
137
135
|
if (this.verbose) {
|
|
138
136
|
await logger.logToStderr(`Checking if site ${args.options.url} exists...`);
|
|
139
137
|
}
|
|
140
|
-
|
|
141
|
-
url: args.options.portalUrl,
|
|
142
|
-
output: 'json',
|
|
143
|
-
debug: this.debug,
|
|
144
|
-
verbose: this.verbose
|
|
145
|
-
};
|
|
146
|
-
return cli.executeCommandWithOutput(spoWebGetCommand, { options: { ...options, _: [] } });
|
|
138
|
+
return await spo.getWeb(args.options.portalUrl, logger, this.verbose);
|
|
147
139
|
}
|
|
148
140
|
}
|
|
149
141
|
_VivaConnectionsAppCreateCommand_instances = new WeakSet(), _VivaConnectionsAppCreateCommand_initOptions = function _VivaConnectionsAppCreateCommand_initOptions() {
|
package/dist/utils/entraGroup.js
CHANGED
|
@@ -103,11 +103,17 @@ export const entraGroup = {
|
|
|
103
103
|
}
|
|
104
104
|
return groups[0].id;
|
|
105
105
|
},
|
|
106
|
-
async setGroup(id, isPrivate, logger, verbose) {
|
|
106
|
+
async setGroup(id, isPrivate, displayName, description, logger, verbose) {
|
|
107
107
|
if (verbose && logger) {
|
|
108
108
|
await logger.logToStderr(`Updating Microsoft 365 Group ${id}...`);
|
|
109
109
|
}
|
|
110
110
|
const update = {};
|
|
111
|
+
if (displayName) {
|
|
112
|
+
update.displayName = displayName;
|
|
113
|
+
}
|
|
114
|
+
if (description) {
|
|
115
|
+
update.description = description;
|
|
116
|
+
}
|
|
111
117
|
if (typeof isPrivate !== 'undefined') {
|
|
112
118
|
update.visibility = isPrivate ? 'Private' : 'Public';
|
|
113
119
|
}
|
package/dist/utils/entraUser.js
CHANGED
|
@@ -112,9 +112,15 @@ export const entraUser = {
|
|
|
112
112
|
},
|
|
113
113
|
/**
|
|
114
114
|
* Retrieve the UPN of a user by its ID.
|
|
115
|
+
* Returns the UPN as string
|
|
115
116
|
* @param id User ID.
|
|
117
|
+
* @param logger The logger object
|
|
118
|
+
* @param verbose Set for verbose logging
|
|
116
119
|
*/
|
|
117
|
-
async getUpnByUserId(id) {
|
|
120
|
+
async getUpnByUserId(id, logger, verbose) {
|
|
121
|
+
if (verbose && logger) {
|
|
122
|
+
await logger.logToStderr(`Retrieving the upn for user ${id}`);
|
|
123
|
+
}
|
|
118
124
|
const requestOptions = {
|
|
119
125
|
url: `${graphResource}/v1.0/users/${id}?$select=userPrincipalName`,
|
|
120
126
|
headers: {
|
package/dist/utils/spo.js
CHANGED
|
@@ -1003,7 +1003,7 @@ export const spo = {
|
|
|
1003
1003
|
promises.push(request.post(requestOptions));
|
|
1004
1004
|
}
|
|
1005
1005
|
if (typeof isPublic !== 'undefined') {
|
|
1006
|
-
promises.push(entraGroup.setGroup(groupId, (isPublic === false), logger, verbose));
|
|
1006
|
+
promises.push(entraGroup.setGroup(groupId, (isPublic === false), undefined, undefined, logger, verbose));
|
|
1007
1007
|
}
|
|
1008
1008
|
if (typeof owners !== 'undefined') {
|
|
1009
1009
|
promises.push(spo.setGroupifiedSiteOwners(spoAdminUrl, groupId, owners, logger, verbose));
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# spe container permission list
|
|
6
|
+
|
|
7
|
+
Lists permissions of a SharePoint Embedded Container
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 spe container permission list [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-i, --containerId <id>`
|
|
19
|
+
: The ID of the SharePoint Embedded Container.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<Global />
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
Lists Container permissions.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
m365 spe container permission list --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Response
|
|
33
|
+
|
|
34
|
+
<Tabs>
|
|
35
|
+
<TabItem value="JSON">
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
"id": "X2k6MCMuZnxtZW1iZXJzaGlwfGRlYnJhYkBuYWNoYW4zNjUub25taWNyb3NvZnQuY29t",
|
|
41
|
+
"roles": [
|
|
42
|
+
"owner"
|
|
43
|
+
],
|
|
44
|
+
"grantedToV2": {
|
|
45
|
+
"user": {
|
|
46
|
+
"displayName": "John Doe",
|
|
47
|
+
"email": "john.doe@contoso.onmicrosoft.com",
|
|
48
|
+
"userPrincipalName": "john.doe@contoso.onmicrosoft.com"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
</TabItem>
|
|
56
|
+
<TabItem value="Text">
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
id userPrincipalName roles
|
|
60
|
+
-------------------------------------------------------------------- -------------------------------- ------
|
|
61
|
+
X2k6MCMuZnxtZW1iZXJzaGlwfGRlYnJhYkBuYWNoYW4zNjUub25taWNyb3NvZnQuY29t john.doe@contoso.onmicrosoft.com owner
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
</TabItem>
|
|
65
|
+
<TabItem value="CSV">
|
|
66
|
+
|
|
67
|
+
```csv
|
|
68
|
+
id,roles,userPrincipalName
|
|
69
|
+
X2k6MCMuZnxtZW1iZXJzaGlwfGRlYnJhYkBuYWNoYW4zNjUub25taWNyb3NvZnQuY29t,owner,john.doe@contoso.onmicrosoft.com
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</TabItem>
|
|
73
|
+
<TabItem value="Markdown">
|
|
74
|
+
|
|
75
|
+
```md
|
|
76
|
+
# spe container permission list --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"
|
|
77
|
+
|
|
78
|
+
Date: 3/3/2025
|
|
79
|
+
|
|
80
|
+
## X2k6MCMuZnxtZW1iZXJzaGlwfGRlYnJhYkBuYWNoYW4zNjUub25taWNyb3NvZnQuY29t
|
|
81
|
+
|
|
82
|
+
Property | Value
|
|
83
|
+
---------|-------
|
|
84
|
+
id | X2k6MCMuZnxtZW1iZXJzaGlwfGRlYnJhYkBuYWNoYW4zNjUub25taWNyb3NvZnQuY29t
|
|
85
|
+
roles | owner
|
|
86
|
+
userPrincipalName | john.doe@contoso.onmicrosoft.com
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
</TabItem>
|
|
90
|
+
</Tabs>
|
|
@@ -32,7 +32,6 @@ m365 spo field get [options]
|
|
|
32
32
|
|
|
33
33
|
`-t, --title [title]`
|
|
34
34
|
: The display name (case-sensitive) of the field to retrieve. Specify either `id`, `title` or `internalName`.
|
|
35
|
-
```
|
|
36
35
|
|
|
37
36
|
`--internalName [internalName]`
|
|
38
37
|
: The internal name (case-sensitive) of the field to retrieve. Specify either `id`, `title` or `internalName`.
|