@pnp/cli-microsoft365 7.10.0-beta.0d80e6e → 7.10.0-beta.4ffb095
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 +2 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +1 -1
- package/dist/chili/chili.js +9 -77
- package/dist/m365/entra/commands/app/app-permission-remove.js +287 -0
- package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +124 -0
- package/dist/m365/entra/commands/pim/pim-role-request-list.js +149 -0
- package/dist/m365/entra/commands.js +3 -0
- package/dist/m365/spo/commands/file/file-add.js +41 -38
- package/dist/m365/spo/commands/folder/folder-add.js +65 -21
- package/dist/m365/spo/commands/site/site-admin-list.js +144 -0
- package/dist/m365/spo/commands/site/site-set.js +22 -24
- package/dist/m365/spo/commands/tenant/tenant-site-archive.js +99 -0
- package/dist/m365/spo/commands/tenant/tenant-site-unarchive.js +98 -0
- package/dist/m365/spo/commands.js +3 -0
- package/dist/m365/teams/commands/user/user-app-add.js +17 -17
- package/dist/m365/teams/commands/user/user-app-upgrade.js +106 -0
- package/dist/m365/teams/commands.js +2 -1
- package/dist/utils/md.js +2 -2
- package/docs/docs/cmd/entra/app/app-permission-remove.mdx +60 -0
- package/docs/docs/cmd/entra/pim/pim-role-assignment-eligibility-list.mdx +205 -0
- package/docs/docs/cmd/entra/pim/pim-role-request-list.mdx +261 -0
- package/docs/docs/cmd/spo/folder/folder-add.mdx +9 -0
- package/docs/docs/cmd/spo/site/site-admin-list.mdx +115 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-archive.mdx +63 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-unarchive.mdx +67 -0
- package/docs/docs/cmd/status.mdx +10 -9
- package/docs/docs/cmd/teams/user/user-app-upgrade.mdx +59 -0
- package/npm-shrinkwrap.json +181 -90
- package/package.json +16 -15
|
@@ -430,33 +430,35 @@ class SpoSiteSetCommand extends SpoCommand {
|
|
|
430
430
|
_SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry = function _SpoSiteSetCommand_initTelemetry() {
|
|
431
431
|
this.telemetry.push((args) => {
|
|
432
432
|
Object.assign(this.telemetryProperties, {
|
|
433
|
-
classification: typeof args.options.classification
|
|
434
|
-
disableFlows: args.options.disableFlows,
|
|
435
|
-
socialBarOnSitePagesDisabled: args.options.socialBarOnSitePagesDisabled,
|
|
436
|
-
isPublic: args.options.isPublic,
|
|
433
|
+
classification: typeof args.options.classification !== 'undefined',
|
|
434
|
+
disableFlows: !!args.options.disableFlows,
|
|
435
|
+
socialBarOnSitePagesDisabled: !!args.options.socialBarOnSitePagesDisabled,
|
|
436
|
+
isPublic: !!args.options.isPublic,
|
|
437
437
|
owners: typeof args.options.owners !== 'undefined',
|
|
438
|
-
shareByEmailEnabled: args.options.shareByEmailEnabled,
|
|
439
|
-
title: typeof args.options.title
|
|
440
|
-
description: typeof args.options.description
|
|
441
|
-
siteDesignId: typeof args.options.siteDesignId !== undefined,
|
|
442
|
-
sharingCapabilities: args.options.sharingCapability,
|
|
438
|
+
shareByEmailEnabled: !!args.options.shareByEmailEnabled,
|
|
439
|
+
title: typeof args.options.title !== 'undefined',
|
|
440
|
+
description: typeof args.options.description !== 'undefined',
|
|
441
|
+
siteDesignId: typeof args.options.siteDesignId !== 'undefined',
|
|
442
|
+
sharingCapabilities: typeof args.options.sharingCapability !== 'undefined',
|
|
443
443
|
siteLogoUrl: typeof args.options.siteLogoUrl !== 'undefined',
|
|
444
444
|
siteThumbnailUrl: typeof args.options.siteThumbnailUrl !== 'undefined',
|
|
445
|
-
resourceQuota: args.options.resourceQuota,
|
|
446
|
-
resourceQuotaWarningLevel: args.options.resourceQuotaWarningLevel,
|
|
447
|
-
storageQuota: args.options.storageQuota,
|
|
448
|
-
storageQuotaWarningLevel: args.options.storageQuotaWarningLevel,
|
|
449
|
-
allowSelfServiceUpgrade: args.options.allowSelfServiceUpgrade,
|
|
450
|
-
lockState: args.options.lockState,
|
|
451
|
-
noScriptSite: args.options.noScriptSite,
|
|
452
|
-
wait: args.options.wait
|
|
445
|
+
resourceQuota: typeof args.options.resourceQuota !== 'undefined',
|
|
446
|
+
resourceQuotaWarningLevel: typeof args.options.resourceQuotaWarningLevel !== 'undefined',
|
|
447
|
+
storageQuota: typeof args.options.storageQuota !== 'undefined',
|
|
448
|
+
storageQuotaWarningLevel: typeof args.options.storageQuotaWarningLevel !== 'undefined',
|
|
449
|
+
allowSelfServiceUpgrade: !!args.options.allowSelfServiceUpgrade,
|
|
450
|
+
lockState: typeof args.options.lockState !== 'undefined',
|
|
451
|
+
noScriptSite: !!args.options.noScriptSite,
|
|
452
|
+
wait: !!args.options.wait
|
|
453
453
|
});
|
|
454
454
|
});
|
|
455
455
|
}, _SpoSiteSetCommand_initOptions = function _SpoSiteSetCommand_initOptions() {
|
|
456
456
|
this.options.unshift({
|
|
457
457
|
option: '-u, --url <url>'
|
|
458
458
|
}, {
|
|
459
|
-
option: '-
|
|
459
|
+
option: '-t, --title [title]'
|
|
460
|
+
}, {
|
|
461
|
+
option: '-d, --description [description]'
|
|
460
462
|
}, {
|
|
461
463
|
option: '--classification [classification]'
|
|
462
464
|
}, {
|
|
@@ -476,16 +478,12 @@ _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry =
|
|
|
476
478
|
}, {
|
|
477
479
|
option: '--siteDesignId [siteDesignId]'
|
|
478
480
|
}, {
|
|
479
|
-
option: '--
|
|
480
|
-
|
|
481
|
-
option: '--description [description]'
|
|
481
|
+
option: '--sharingCapability [sharingCapability]',
|
|
482
|
+
autocomplete: this.sharingCapabilities
|
|
482
483
|
}, {
|
|
483
484
|
option: '--siteLogoUrl [siteLogoUrl]'
|
|
484
485
|
}, {
|
|
485
486
|
option: '--siteThumbnailUrl [siteThumbnailUrl]'
|
|
486
|
-
}, {
|
|
487
|
-
option: '--sharingCapability [sharingCapability]',
|
|
488
|
-
autocomplete: this.sharingCapabilities
|
|
489
487
|
}, {
|
|
490
488
|
option: '--resourceQuota [resourceQuota]'
|
|
491
489
|
}, {
|
|
@@ -0,0 +1,99 @@
|
|
|
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 _SpoTenantSiteArchiveCommand_instances, _SpoTenantSiteArchiveCommand_initTelemetry, _SpoTenantSiteArchiveCommand_initOptions, _SpoTenantSiteArchiveCommand_initValidators, _SpoTenantSiteArchiveCommand_initTypes;
|
|
7
|
+
import { cli } from '../../../../cli/cli.js';
|
|
8
|
+
import config from '../../../../config.js';
|
|
9
|
+
import request from '../../../../request.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import { spo } from '../../../../utils/spo.js';
|
|
12
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class SpoTenantSiteArchiveCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.TENANT_SITE_ARCHIVE;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Archives a site collection';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoTenantSiteArchiveCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initTypes).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
const archiveSite = async () => {
|
|
31
|
+
try {
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
await logger.logToStderr(`Archiving site ${args.options.url}...`);
|
|
34
|
+
}
|
|
35
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
36
|
+
const reqDigest = await spo.getRequestDigest(spoAdminUrl);
|
|
37
|
+
const requestOptions = {
|
|
38
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
39
|
+
headers: {
|
|
40
|
+
'X-RequestDigest': reqDigest.FormDigestValue
|
|
41
|
+
},
|
|
42
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
|
|
43
|
+
<Actions>
|
|
44
|
+
<ObjectPath Id="2" ObjectPathId="1" />
|
|
45
|
+
<ObjectPath Id="4" ObjectPathId="3" />
|
|
46
|
+
<Query Id="5" ObjectPathId="3">
|
|
47
|
+
<Query SelectAllProperties="true">
|
|
48
|
+
<Properties />
|
|
49
|
+
</Query>
|
|
50
|
+
</Query>
|
|
51
|
+
</Actions>
|
|
52
|
+
<ObjectPaths>
|
|
53
|
+
<Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
|
|
54
|
+
<Method Id="3" ParentId="1" Name="ArchiveSiteByUrl">
|
|
55
|
+
<Parameters>
|
|
56
|
+
<Parameter Type="String">${args.options.url}</Parameter>
|
|
57
|
+
</Parameters>
|
|
58
|
+
</Method>
|
|
59
|
+
</ObjectPaths>
|
|
60
|
+
</Request>`
|
|
61
|
+
};
|
|
62
|
+
const res = await request.post(requestOptions);
|
|
63
|
+
const json = JSON.parse(res);
|
|
64
|
+
const response = json[0];
|
|
65
|
+
if (response.ErrorInfo) {
|
|
66
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
this.handleRejectedPromise(err);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (args.options.force) {
|
|
74
|
+
await archiveSite();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to archive site '${args.options.url}'?` });
|
|
78
|
+
if (result) {
|
|
79
|
+
await archiveSite();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
_SpoTenantSiteArchiveCommand_instances = new WeakSet(), _SpoTenantSiteArchiveCommand_initTelemetry = function _SpoTenantSiteArchiveCommand_initTelemetry() {
|
|
85
|
+
this.telemetry.push((args) => {
|
|
86
|
+
Object.assign(this.telemetryProperties, {
|
|
87
|
+
force: !!args.options.force
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}, _SpoTenantSiteArchiveCommand_initOptions = function _SpoTenantSiteArchiveCommand_initOptions() {
|
|
91
|
+
this.options.unshift({ option: '-u, --url <url>' }, { option: '-f, --force' });
|
|
92
|
+
}, _SpoTenantSiteArchiveCommand_initValidators = function _SpoTenantSiteArchiveCommand_initValidators() {
|
|
93
|
+
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
|
|
94
|
+
}, _SpoTenantSiteArchiveCommand_initTypes = function _SpoTenantSiteArchiveCommand_initTypes() {
|
|
95
|
+
this.types.string.push('url');
|
|
96
|
+
this.types.boolean.push('force');
|
|
97
|
+
};
|
|
98
|
+
export default new SpoTenantSiteArchiveCommand();
|
|
99
|
+
//# sourceMappingURL=tenant-site-archive.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
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 _SpoTenantSiteUnarchiveCommand_instances, _SpoTenantSiteUnarchiveCommand_initTelemetry, _SpoTenantSiteUnarchiveCommand_initOptions, _SpoTenantSiteUnarchiveCommand_initValidators, _SpoTenantSiteUnarchiveCommand_initTypes;
|
|
7
|
+
import { cli } from '../../../../cli/cli.js';
|
|
8
|
+
import config from '../../../../config.js';
|
|
9
|
+
import request from '../../../../request.js';
|
|
10
|
+
import { spo } from '../../../../utils/spo.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class SpoTenantSiteUnarchiveCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.TENANT_SITE_UNARCHIVE;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Unarchives a site collection';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoTenantSiteUnarchiveCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initTypes).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
if (args.options.force) {
|
|
31
|
+
await this.unarchiveSite(logger, args.options.url);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to unarchive site '${args.options.url}'? This may cause additional billing costs.` });
|
|
35
|
+
if (result) {
|
|
36
|
+
await this.unarchiveSite(logger, args.options.url);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async unarchiveSite(logger, url) {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
await logger.logToStderr(`Unarchiving site '${url}'...`);
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const adminCenterUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
46
|
+
const requestDigest = await spo.getRequestDigest(adminCenterUrl);
|
|
47
|
+
const requestOptions = {
|
|
48
|
+
url: `${adminCenterUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
49
|
+
headers: {
|
|
50
|
+
'X-RequestDigest': requestDigest.FormDigestValue
|
|
51
|
+
},
|
|
52
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
|
|
53
|
+
<Actions>
|
|
54
|
+
<ObjectPath Id="2" ObjectPathId="1" />
|
|
55
|
+
<ObjectPath Id="4" ObjectPathId="3" />
|
|
56
|
+
</Actions>
|
|
57
|
+
<ObjectPaths>
|
|
58
|
+
<Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
|
|
59
|
+
<Method Id="3" ParentId="1" Name="UnarchiveSiteByUrl">
|
|
60
|
+
<Parameters>
|
|
61
|
+
<Parameter Type="String">${url}</Parameter>
|
|
62
|
+
</Parameters>
|
|
63
|
+
</Method>
|
|
64
|
+
</ObjectPaths>
|
|
65
|
+
</Request>`
|
|
66
|
+
};
|
|
67
|
+
const response = await request.post(requestOptions);
|
|
68
|
+
const json = JSON.parse(response);
|
|
69
|
+
const responseContent = json[0];
|
|
70
|
+
if (responseContent.ErrorInfo) {
|
|
71
|
+
throw responseContent.ErrorInfo.ErrorMessage;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
this.handleRejectedPromise(err);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
_SpoTenantSiteUnarchiveCommand_instances = new WeakSet(), _SpoTenantSiteUnarchiveCommand_initTelemetry = function _SpoTenantSiteUnarchiveCommand_initTelemetry() {
|
|
80
|
+
this.telemetry.push((args) => {
|
|
81
|
+
Object.assign(this.telemetryProperties, {
|
|
82
|
+
force: !!args.options.force
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}, _SpoTenantSiteUnarchiveCommand_initOptions = function _SpoTenantSiteUnarchiveCommand_initOptions() {
|
|
86
|
+
this.options.unshift({
|
|
87
|
+
option: '-u, --url <url>'
|
|
88
|
+
}, {
|
|
89
|
+
option: '-f, --force'
|
|
90
|
+
});
|
|
91
|
+
}, _SpoTenantSiteUnarchiveCommand_initValidators = function _SpoTenantSiteUnarchiveCommand_initValidators() {
|
|
92
|
+
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
|
|
93
|
+
}, _SpoTenantSiteUnarchiveCommand_initTypes = function _SpoTenantSiteUnarchiveCommand_initTypes() {
|
|
94
|
+
this.types.string.push('url');
|
|
95
|
+
this.types.boolean.push('force');
|
|
96
|
+
};
|
|
97
|
+
export default new SpoTenantSiteUnarchiveCommand();
|
|
98
|
+
//# sourceMappingURL=tenant-site-unarchive.js.map
|
|
@@ -239,6 +239,7 @@ export default {
|
|
|
239
239
|
SERVICEPRINCIPAL_SET: `${prefix} serviceprincipal set`,
|
|
240
240
|
SET: `${prefix} set`,
|
|
241
241
|
SITE_ADD: `${prefix} site add`,
|
|
242
|
+
SITE_ADMIN_LIST: `${prefix} site admin list`,
|
|
242
243
|
SITE_APPCATALOG_ADD: `${prefix} site appcatalog add`,
|
|
243
244
|
SITE_APPCATALOG_LIST: `${prefix} site appcatalog list`,
|
|
244
245
|
SITE_APPCATALOG_REMOVE: `${prefix} site appcatalog remove`,
|
|
@@ -312,6 +313,8 @@ export default {
|
|
|
312
313
|
TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
|
|
313
314
|
TENANT_SETTINGS_LIST: `${prefix} tenant settings list`,
|
|
314
315
|
TENANT_SETTINGS_SET: `${prefix} tenant settings set`,
|
|
316
|
+
TENANT_SITE_ARCHIVE: `${prefix} tenant site archive`,
|
|
317
|
+
TENANT_SITE_UNARCHIVE: `${prefix} tenant site unarchive`,
|
|
315
318
|
TERM_ADD: `${prefix} term add`,
|
|
316
319
|
TERM_GET: `${prefix} term get`,
|
|
317
320
|
TERM_LIST: `${prefix} term list`,
|
|
@@ -26,24 +26,24 @@ class TeamsUserAppAddCommand extends GraphCommand {
|
|
|
26
26
|
__classPrivateFieldGet(this, _TeamsUserAppAddCommand_instances, "m", _TeamsUserAppAddCommand_initOptionSets).call(this);
|
|
27
27
|
}
|
|
28
28
|
async commandAction(logger, args) {
|
|
29
|
-
const appId = await this.getAppId(args);
|
|
30
|
-
const userId = (args.options.userId ?? args.options.userName);
|
|
31
|
-
const endpoint = `${this.resource}/v1.0`;
|
|
32
|
-
if (this.verbose) {
|
|
33
|
-
await logger.logToStderr(`Removing app with ID ${appId} for user ${args.options.userId}`);
|
|
34
|
-
}
|
|
35
|
-
const requestOptions = {
|
|
36
|
-
url: `${endpoint}/users/${formatting.encodeQueryParameter(userId)}/teamwork/installedApps`,
|
|
37
|
-
headers: {
|
|
38
|
-
'content-type': 'application/json;odata=nometadata',
|
|
39
|
-
'accept': 'application/json;odata.metadata=none'
|
|
40
|
-
},
|
|
41
|
-
responseType: 'json',
|
|
42
|
-
data: {
|
|
43
|
-
'teamsApp@odata.bind': `${endpoint}/appCatalogs/teamsApps/${appId}`
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
29
|
try {
|
|
30
|
+
const appId = await this.getAppId(args);
|
|
31
|
+
const userId = (args.options.userId ?? args.options.userName);
|
|
32
|
+
const endpoint = `${this.resource}/v1.0`;
|
|
33
|
+
if (this.verbose) {
|
|
34
|
+
await logger.logToStderr(`Adding app with ID ${appId} for user ${args.options.userId}`);
|
|
35
|
+
}
|
|
36
|
+
const requestOptions = {
|
|
37
|
+
url: `${endpoint}/users/${formatting.encodeQueryParameter(userId)}/teamwork/installedApps`,
|
|
38
|
+
headers: {
|
|
39
|
+
'content-type': 'application/json;odata=nometadata',
|
|
40
|
+
'accept': 'application/json;odata.metadata=none'
|
|
41
|
+
},
|
|
42
|
+
responseType: 'json',
|
|
43
|
+
data: {
|
|
44
|
+
'teamsApp@odata.bind': `${endpoint}/appCatalogs/teamsApps/${appId}`
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
47
|
await request.post(requestOptions);
|
|
48
48
|
}
|
|
49
49
|
catch (err) {
|
|
@@ -0,0 +1,106 @@
|
|
|
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 _TeamsUserAppUpgradeCommand_instances, _TeamsUserAppUpgradeCommand_initTelemetry, _TeamsUserAppUpgradeCommand_initOptions, _TeamsUserAppUpgradeCommand_initValidators, _TeamsUserAppUpgradeCommand_initOptionSets, _TeamsUserAppUpgradeCommand_initTypes;
|
|
7
|
+
import { cli } from '../../../../cli/cli.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { odata } from '../../../../utils/odata.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class TeamsUserAppUpgradeCommand extends GraphCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.USER_APP_UPGRADE;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Upgrade an app in the personal scope of the specified user';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_TeamsUserAppUpgradeCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _TeamsUserAppUpgradeCommand_instances, "m", _TeamsUserAppUpgradeCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _TeamsUserAppUpgradeCommand_instances, "m", _TeamsUserAppUpgradeCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _TeamsUserAppUpgradeCommand_instances, "m", _TeamsUserAppUpgradeCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _TeamsUserAppUpgradeCommand_instances, "m", _TeamsUserAppUpgradeCommand_initOptionSets).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _TeamsUserAppUpgradeCommand_instances, "m", _TeamsUserAppUpgradeCommand_initTypes).call(this);
|
|
29
|
+
}
|
|
30
|
+
async commandAction(logger, args) {
|
|
31
|
+
try {
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
await logger.logToStderr(`Upgrading app ${args.options.id || args.options.name} for user ${args.options.userId || args.options.userName}`);
|
|
34
|
+
}
|
|
35
|
+
const installedAppId = await this.getInstalledAppId(args.options, logger);
|
|
36
|
+
const requestOptions = {
|
|
37
|
+
url: `${this.resource}/v1.0/users/${formatting.encodeQueryParameter(args.options.userId || args.options.userName)}/teamwork/installedApps/${installedAppId}/upgrade`,
|
|
38
|
+
headers: {
|
|
39
|
+
'accept': 'application/json;odata.metadata=none'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
await request.post(requestOptions);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
this.handleRejectedODataJsonPromise(err);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async getInstalledAppId(options, logger) {
|
|
49
|
+
if (this.verbose) {
|
|
50
|
+
await logger.logToStderr(`Retrieving app ID`);
|
|
51
|
+
}
|
|
52
|
+
if (options.id) {
|
|
53
|
+
return options.id;
|
|
54
|
+
}
|
|
55
|
+
const installedApps = await odata.getAllItems(`${this.resource}/v1.0/users/${formatting.encodeQueryParameter(options.userId || options.userName)}/teamwork/installedApps?$expand=teamsAppDefinition&$filter=teamsAppDefinition/displayName eq '${formatting.encodeQueryParameter(options.name)}'&$select=id`);
|
|
56
|
+
if (installedApps.length === 1) {
|
|
57
|
+
return installedApps[0].id;
|
|
58
|
+
}
|
|
59
|
+
if (installedApps.length === 0) {
|
|
60
|
+
throw `The specified Teams app ${options.name} does not exist or is not installed for the user`;
|
|
61
|
+
}
|
|
62
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', installedApps);
|
|
63
|
+
const result = (await cli.handleMultipleResultsFound(`Multiple installed Teams apps with name '${options.name}' found.`, resultAsKeyValuePair));
|
|
64
|
+
return result.id;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
_TeamsUserAppUpgradeCommand_instances = new WeakSet(), _TeamsUserAppUpgradeCommand_initTelemetry = function _TeamsUserAppUpgradeCommand_initTelemetry() {
|
|
68
|
+
this.telemetry.push((args) => {
|
|
69
|
+
Object.assign(this.telemetryProperties, {
|
|
70
|
+
id: typeof args.options.id !== 'undefined',
|
|
71
|
+
name: typeof args.options.name !== 'undefined',
|
|
72
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
73
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}, _TeamsUserAppUpgradeCommand_initOptions = function _TeamsUserAppUpgradeCommand_initOptions() {
|
|
77
|
+
this.options.unshift({
|
|
78
|
+
option: '--id [id]'
|
|
79
|
+
}, {
|
|
80
|
+
option: '--name [name]'
|
|
81
|
+
}, {
|
|
82
|
+
option: '--userId [userId]'
|
|
83
|
+
}, {
|
|
84
|
+
option: '--userName [userName]'
|
|
85
|
+
});
|
|
86
|
+
}, _TeamsUserAppUpgradeCommand_initValidators = function _TeamsUserAppUpgradeCommand_initValidators() {
|
|
87
|
+
this.validators.push(async (args) => {
|
|
88
|
+
if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
|
|
89
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
90
|
+
}
|
|
91
|
+
if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
|
|
92
|
+
return `${args.options.userName} is not a valid userName`;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
}, _TeamsUserAppUpgradeCommand_initOptionSets = function _TeamsUserAppUpgradeCommand_initOptionSets() {
|
|
97
|
+
this.optionSets.push({
|
|
98
|
+
options: ['id', 'name']
|
|
99
|
+
}, {
|
|
100
|
+
options: ['userId', 'userName']
|
|
101
|
+
});
|
|
102
|
+
}, _TeamsUserAppUpgradeCommand_initTypes = function _TeamsUserAppUpgradeCommand_initTypes() {
|
|
103
|
+
this.types.string.push('id', 'name', 'userId', 'userName');
|
|
104
|
+
};
|
|
105
|
+
export default new TeamsUserAppUpgradeCommand();
|
|
106
|
+
//# sourceMappingURL=user-app-upgrade.js.map
|
|
@@ -67,6 +67,7 @@ export default {
|
|
|
67
67
|
USER_SET: `${prefix} user set`,
|
|
68
68
|
USER_APP_ADD: `${prefix} user app add`,
|
|
69
69
|
USER_APP_LIST: `${prefix} user app list`,
|
|
70
|
-
USER_APP_REMOVE: `${prefix} user app remove
|
|
70
|
+
USER_APP_REMOVE: `${prefix} user app remove`,
|
|
71
|
+
USER_APP_UPGRADE: `${prefix} user app upgrade`
|
|
71
72
|
};
|
|
72
73
|
//# sourceMappingURL=commands.js.map
|
package/dist/utils/md.js
CHANGED
|
@@ -22,7 +22,7 @@ function includeContent(md, rootFolder) {
|
|
|
22
22
|
{ tag: "<CLISettings />", location: "docs/_clisettings.mdx" }
|
|
23
23
|
];
|
|
24
24
|
mdxImports.forEach(mdxImport => {
|
|
25
|
-
md = md.replace(mdxImport.tag, () => fs.readFileSync(path.join(rootFolder, mdxImport.location), 'utf8')).replace(/(```\r
|
|
25
|
+
md = md.replace(mdxImport.tag, () => fs.readFileSync(path.join(rootFolder, mdxImport.location), 'utf8')).replace(/(```\r?\n)\r?\n(```md definition-list\r?\n)/g, "$1$2");
|
|
26
26
|
});
|
|
27
27
|
return md;
|
|
28
28
|
}
|
|
@@ -54,7 +54,7 @@ function convertContentTabs(md) {
|
|
|
54
54
|
.trim();
|
|
55
55
|
}
|
|
56
56
|
function convertCodeFences(md) {
|
|
57
|
-
const regex = new RegExp('^```.*?(?:\r
|
|
57
|
+
const regex = new RegExp('^```.*?(?:\r?\n)(.*?)```(?:\r?\n)', 'gms');
|
|
58
58
|
return md.replace(regex, (match, code) => {
|
|
59
59
|
return `${code.replace(/^(.+)$/gm, ' $1')}${EOL}`;
|
|
60
60
|
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
|
|
3
|
+
# entra app permission remove
|
|
4
|
+
|
|
5
|
+
Removes the specified application and/or delegated permissions from a specified Entra app.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
m365 entra app permission remove [options]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Options
|
|
14
|
+
|
|
15
|
+
```md definition-list
|
|
16
|
+
`-i, --appId [appId]`
|
|
17
|
+
: Client ID of the Microsoft Entra app to remove the API permissions from. Specify either `appId`, `appName` or `appObjectId`.
|
|
18
|
+
|
|
19
|
+
`--appObjectId [appObjectId]`
|
|
20
|
+
: Object ID of the Microsoft Entra app to remove the API permissions from. Specify either `appId`, `appName` or `appObjectId`.
|
|
21
|
+
|
|
22
|
+
`-n, --appName [appName]`
|
|
23
|
+
: Display name of the Entra app to remove the API permissions from. Specify either `appId`, `appName` or `appObjectId`.
|
|
24
|
+
|
|
25
|
+
`-a, --applicationPermissions [applicationPermissions]`
|
|
26
|
+
: Space-separated list of application permissions to remove. Specify at least `applicationPermissions` or `delegatedPermissions`.
|
|
27
|
+
|
|
28
|
+
`-d, --delegatedPermissions [delegatedPermissions]`
|
|
29
|
+
: Space-separated list of delegated permissions to remove. Specify at least `applicationPermissions` or `delegatedPermissions`.
|
|
30
|
+
|
|
31
|
+
`--revokeAdminConsent`
|
|
32
|
+
: When specified, revokes the admin consent for the specified permissions as well.
|
|
33
|
+
|
|
34
|
+
`-f, --force`
|
|
35
|
+
: Don't prompt for confirmation to remove the permissions.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<Global />
|
|
39
|
+
|
|
40
|
+
## Remarks
|
|
41
|
+
|
|
42
|
+
Removing permissions on App Registrations does not immediately remove consent given by an administrator. Explicitly instruct the CLI to revoke consent by using the `--revokeAdminConsent` flag.
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
Remove multiple delegated API permissions from an Entra app registration
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
m365 entra app permission remove --appId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --delegatedPermissions 'https://management.azure.com/user_impersonation https://service.flow.microsoft.com/Flows.Read.All https://graph.microsoft.com/Agreement.Read.All'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Remove multiple app-only permissions from an Entra app registration and revoke admin consent
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
m365 entra app permission remove --appId 'f1417aa3-bf0b-4cc5-a845-a0b2cf11f690' --applicationPermissions 'https://graph.microsoft.com/Sites.FullControl.All https://microsoft.sharepoint-df.com/Sites.FullControl.All' --revokeAdminConsent
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Response
|
|
59
|
+
|
|
60
|
+
The command won't return a response on success.
|