@pnp/cli-microsoft365 5.9.0-beta.005c47a → 5.9.0-beta.3de06bc

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.
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const request_1 = require("../../../../request");
13
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
14
+ const commands_1 = require("../../commands");
15
+ class PpTenantSettingsListCommand extends PowerPlatformCommand_1.default {
16
+ get name() {
17
+ return commands_1.default.TENANT_SETTINGS_LIST;
18
+ }
19
+ get description() {
20
+ return 'Lists the global Power Platform tenant settings';
21
+ }
22
+ defaultProperties() {
23
+ return ['disableCapacityAllocationByEnvironmentAdmins', 'disableEnvironmentCreationByNonAdminUsers', 'disableNPSCommentsReachout', 'disablePortalsCreationByNonAdminUsers', 'disableSupportTicketsVisibleByAllUsers', 'disableSurveyFeedback', 'disableTrialEnvironmentCreationByNonAdminUsers', 'walkMeOptOut'];
24
+ }
25
+ commandAction(logger) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const requestOptions = {
28
+ url: `${this.resource}/providers/Microsoft.BusinessAppPlatform/listtenantsettings?api-version=2020-10-01`,
29
+ headers: {
30
+ accept: 'application/json'
31
+ },
32
+ responseType: 'json'
33
+ };
34
+ try {
35
+ const res = yield request_1.default.post(requestOptions);
36
+ logger.log(res);
37
+ }
38
+ catch (err) {
39
+ this.handleRejectedODataJsonPromise(err);
40
+ }
41
+ });
42
+ }
43
+ }
44
+ module.exports = new PpTenantSettingsListCommand();
45
+ //# sourceMappingURL=tenant-settings-list.js.map
@@ -5,6 +5,7 @@ exports.default = {
5
5
  ENVIRONMENT_LIST: `${prefix} environment list`,
6
6
  GATEWAY_LIST: `${prefix} gateway list`,
7
7
  MANAGEMENTAPP_ADD: `${prefix} managementapp add`,
8
- MANAGEMENTAPP_LIST: `${prefix} managementapp list`
8
+ MANAGEMENTAPP_LIST: `${prefix} managementapp list`,
9
+ TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
9
10
  };
10
11
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoFileRoleAssignmentRemoveCommand_instances, _SpoFileRoleAssignmentRemoveCommand_initTelemetry, _SpoFileRoleAssignmentRemoveCommand_initOptions, _SpoFileRoleAssignmentRemoveCommand_initValidators, _SpoFileRoleAssignmentRemoveCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
21
+ const formatting_1 = require("../../../../utils/formatting");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const SpoCommand_1 = require("../../../base/SpoCommand");
24
+ const commands_1 = require("../../commands");
25
+ const SpoFileGetCommand = require("./file-get");
26
+ const SpoUserGetCommand = require("../user/user-get");
27
+ const SpoGroupGetCommand = require("../group/group-get");
28
+ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand_1.default {
29
+ constructor() {
30
+ super();
31
+ _SpoFileRoleAssignmentRemoveCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initTelemetry).call(this);
33
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptions).call(this);
34
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initValidators).call(this);
35
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptionSets).call(this);
36
+ }
37
+ get name() {
38
+ return commands_1.default.FILE_ROLEASSIGNMENT_REMOVE;
39
+ }
40
+ get description() {
41
+ return 'Removes a role assignment from a file.';
42
+ }
43
+ commandAction(logger, args) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const removeRoleAssignment = () => __awaiter(this, void 0, void 0, function* () {
46
+ try {
47
+ const fileURL = yield this.getFileURL(args);
48
+ let principalId;
49
+ if (args.options.groupName) {
50
+ principalId = yield this.getGroupPrincipalId(args.options);
51
+ }
52
+ else if (args.options.upn) {
53
+ principalId = yield this.getUserPrincipalId(args.options);
54
+ }
55
+ else {
56
+ principalId = args.options.principalId;
57
+ }
58
+ const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, fileURL);
59
+ const requestOptions = {
60
+ url: `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}')/ListItemAllFields/roleassignments/removeroleassignment(principalid='${principalId}')`,
61
+ headers: {
62
+ accept: 'application/json;odata=nometadata'
63
+ },
64
+ responseType: 'json'
65
+ };
66
+ yield request_1.default.post(requestOptions);
67
+ }
68
+ catch (err) {
69
+ this.handleRejectedODataJsonPromise(err);
70
+ }
71
+ });
72
+ if (args.options.confirm) {
73
+ yield removeRoleAssignment();
74
+ }
75
+ else {
76
+ const result = yield Cli_1.Cli.prompt({
77
+ type: 'confirm',
78
+ name: 'continue',
79
+ default: false,
80
+ message: `Are you sure you want to remove role assignment from file ${args.options.fileUrl || args.options.fileId} from site ${args.options.webUrl}?`
81
+ });
82
+ if (result.continue) {
83
+ yield removeRoleAssignment();
84
+ }
85
+ }
86
+ });
87
+ }
88
+ getFileURL(args) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ if (args.options.fileUrl) {
91
+ return args.options.fileUrl;
92
+ }
93
+ const options = {
94
+ webUrl: args.options.webUrl,
95
+ id: args.options.fileId,
96
+ output: 'json',
97
+ debug: this.debug,
98
+ verbose: this.verbose
99
+ };
100
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoFileGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
101
+ const getFileOutput = JSON.parse(output.stdout);
102
+ return getFileOutput.ServerRelativeUrl;
103
+ });
104
+ }
105
+ getUserPrincipalId(options) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ const userGetCommandOptions = {
108
+ webUrl: options.webUrl,
109
+ email: options.upn,
110
+ id: undefined,
111
+ output: 'json',
112
+ debug: this.debug,
113
+ verbose: this.verbose
114
+ };
115
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
116
+ const getUserOutput = JSON.parse(output.stdout);
117
+ return getUserOutput.Id;
118
+ });
119
+ }
120
+ getGroupPrincipalId(options) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ const groupGetCommandOptions = {
123
+ webUrl: options.webUrl,
124
+ name: options.groupName,
125
+ output: 'json',
126
+ debug: this.debug,
127
+ verbose: this.verbose
128
+ };
129
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
130
+ const getGroupOutput = JSON.parse(output.stdout);
131
+ return getGroupOutput.Id;
132
+ });
133
+ }
134
+ }
135
+ _SpoFileRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoFileRoleAssignmentRemoveCommand_initTelemetry = function _SpoFileRoleAssignmentRemoveCommand_initTelemetry() {
136
+ this.telemetry.push((args) => {
137
+ Object.assign(this.telemetryProperties, {
138
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
139
+ fileId: typeof args.options.fileId !== 'undefined',
140
+ principalId: typeof args.options.principalId !== 'undefined',
141
+ upn: typeof args.options.upn !== 'undefined',
142
+ groupName: typeof args.options.groupName !== 'undefined',
143
+ confirm: !!args.options.confirm
144
+ });
145
+ });
146
+ }, _SpoFileRoleAssignmentRemoveCommand_initOptions = function _SpoFileRoleAssignmentRemoveCommand_initOptions() {
147
+ this.options.unshift({
148
+ option: '-u, --webUrl <webUrl>'
149
+ }, {
150
+ option: '--fileUrl [fileUrl]'
151
+ }, {
152
+ option: '-i, --fileId [fileId]'
153
+ }, {
154
+ option: '--principalId [principalId]'
155
+ }, {
156
+ option: '--upn [upn]'
157
+ }, {
158
+ option: '--groupName [groupName]'
159
+ }, {
160
+ option: '--confirm'
161
+ });
162
+ }, _SpoFileRoleAssignmentRemoveCommand_initValidators = function _SpoFileRoleAssignmentRemoveCommand_initValidators() {
163
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
164
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
165
+ if (isValidSharePointUrl !== true) {
166
+ return isValidSharePointUrl;
167
+ }
168
+ if (args.options.principalId && isNaN(args.options.principalId)) {
169
+ return `Specified principalId ${args.options.principalId} is not a number`;
170
+ }
171
+ if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
172
+ return `${args.options.fileId} is not a valid GUID`;
173
+ }
174
+ return true;
175
+ }));
176
+ }, _SpoFileRoleAssignmentRemoveCommand_initOptionSets = function _SpoFileRoleAssignmentRemoveCommand_initOptionSets() {
177
+ this.optionSets.push(['fileUrl', 'fileId'], ['upn', 'groupName', 'principalId']);
178
+ };
179
+ module.exports = new SpoFileRoleAssignmentRemoveCommand();
180
+ //# sourceMappingURL=file-roleassignment-remove.js.map
@@ -56,6 +56,7 @@ exports.default = {
56
56
  FILE_MOVE: `${prefix} file move`,
57
57
  FILE_REMOVE: `${prefix} file remove`,
58
58
  FILE_RENAME: `${prefix} file rename`,
59
+ FILE_ROLEASSIGNMENT_REMOVE: `${prefix} file roleassignment remove`,
59
60
  FILE_ROLEINHERITANCE_RESET: `${prefix} file roleinheritance reset`,
60
61
  FILE_SHARINGINFO_GET: `${prefix} file sharinginfo get`,
61
62
  FOLDER_ADD: `${prefix} folder add`,
@@ -0,0 +1,26 @@
1
+ # pp tenant settings list
2
+
3
+ Lists the global Power Platform tenant settings
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 pp tenant settings list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ --8<-- "docs/cmd/_global.md"
14
+
15
+ ## Remarks
16
+
17
+ !!! attention
18
+ This command is based on an API that is currently in preview and is subject to change once the API reached general availability.
19
+
20
+ ## Examples
21
+
22
+ Lists the global Power Platform settings of the tenant
23
+
24
+ ```sh
25
+ m365 pp tenant settings list
26
+ ```
@@ -0,0 +1,54 @@
1
+ # spo file roleassignment remove
2
+
3
+ Removes a role assignment from a file.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo file roleassignment remove [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site where the file is located.
15
+
16
+ `--fileUrl [fileUrl]`
17
+ : The server-relative URL of the file. Specify either `fileUrl` or `fileId` but not both.
18
+
19
+ `-i, --fileId [fileId]`
20
+ : The UniqueId (GUID) of the file. Specify either `fileUrl` or `fileId` but not both.
21
+
22
+ `--principalId [principalId]`
23
+ : The SharePoint Id of the principal. It may be either a user id or group id. Specify either `upn`, `groupName`, or `principalId`.
24
+
25
+ `--upn [upn]`
26
+ : Upn/email of the user. Specify either `upn`, `groupName`, or `principalId`.
27
+
28
+ `--groupName [groupName]`
29
+ : The group name of an Azure AD or SharePoint group. Specify either `upn`, `groupName`, or `principalId`.
30
+
31
+ `--confirm [confirm]`
32
+ : Don't prompt for confirmation.
33
+
34
+ --8<-- "docs/cmd/_global.md"
35
+
36
+ ## Examples
37
+
38
+ Remove a role assignment by principal id from a file by id
39
+
40
+ ```sh
41
+ m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --fileId "b2307a39-e878-458b-bc90-03bc578531d6" --principalId 2
42
+ ```
43
+
44
+ Remove a role assignment by upn from a file by url
45
+
46
+ ```sh
47
+ m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --fileUrl "/sites/contoso-sales/documents/Test1.docx" --upn "user1@contoso.onmicrosoft.com"
48
+ ```
49
+
50
+ Remove a role assignment by group name from a file by id
51
+
52
+ ```sh
53
+ m365 spo file roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --fileId "b2307a39-e878-458b-bc90-03bc578531d6" --groupName "saleGroup"
54
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.9.0-beta.005c47a",
3
+ "version": "5.9.0-beta.3de06bc",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",