@simplysf/simply-permissions 1.2.30 → 1.3.0
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/README.md +115 -0
- package/lib/commands/simply/permissions/assignment/delete.d.ts +29 -0
- package/lib/commands/simply/permissions/assignment/delete.js +116 -0
- package/lib/commands/simply/permissions/assignment/delete.js.map +1 -0
- package/messages/simply.permissions.assignment.delete.md +49 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -65,6 +65,121 @@ FLAG DESCRIPTIONS
|
|
|
65
65
|
The path to write the generated HTML report to.
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
_See code: [lib/commands/simply/permissions/analyze.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-permissions@1.2.31/packages/simply-permissions/lib/commands/simply/permissions/analyze.js)_
|
|
69
|
+
|
|
70
|
+
## `sf simply permissions build`
|
|
71
|
+
|
|
72
|
+
Generate a permission set from Salesforce source metadata.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
USAGE
|
|
76
|
+
$ sf simply permissions build --type read-only|view-all|modify-all -n <value> -d <value> --output <value> [--json]
|
|
77
|
+
[--flags-dir <value>] [-c <value>] [--include-record-types] [--label <value>] [--description <value>]
|
|
78
|
+
|
|
79
|
+
FLAGS
|
|
80
|
+
-c, --config=<value> Path to a permission set configuration file
|
|
81
|
+
-d, --directory=<value> (required) Path to the Salesforce project directory
|
|
82
|
+
-n, --name=<value> (required) API name for the permission set
|
|
83
|
+
--description=<value> Description for the permission set
|
|
84
|
+
--include-record-types Include record type visibilities
|
|
85
|
+
--label=<value> Label for the permission set
|
|
86
|
+
--output=<value> (required) Output directory
|
|
87
|
+
--type=<option> (required) Baseline permission type
|
|
88
|
+
<options: read-only|view-all|modify-all>
|
|
89
|
+
|
|
90
|
+
GLOBAL FLAGS
|
|
91
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
92
|
+
--json Format output as json.
|
|
93
|
+
|
|
94
|
+
DESCRIPTION
|
|
95
|
+
Generate a permission set from Salesforce source metadata.
|
|
96
|
+
|
|
97
|
+
Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally) record types, then generates a
|
|
98
|
+
permission set XML file with a baseline of permissions determined by --type. An optional JSON --config file can
|
|
99
|
+
override individual object, field, tab, record type, and user permission settings, as well as whether the permission
|
|
100
|
+
set requires activation.
|
|
101
|
+
|
|
102
|
+
EXAMPLES
|
|
103
|
+
$ sf simply permissions build --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets
|
|
104
|
+
|
|
105
|
+
$ sf simply permissions build --type modify-all --name My_Admin_Access --directory force-app --config config/permission-overrides.json --output force-app/main/default/permissionsets --include-record-types
|
|
106
|
+
|
|
107
|
+
FLAG DESCRIPTIONS
|
|
108
|
+
-c, --config=<value> Path to a permission set configuration file
|
|
109
|
+
|
|
110
|
+
The path to a JSON file that overrides individual object, field, tab, record type, and user permission settings, as
|
|
111
|
+
well as whether the permission set requires activation, on top of the --type baseline.
|
|
112
|
+
|
|
113
|
+
-d, --directory=<value> Path to the Salesforce project directory
|
|
114
|
+
|
|
115
|
+
The path to the Salesforce source directory to scan for custom objects, fields, tabs, and record types.
|
|
116
|
+
|
|
117
|
+
-n, --name=<value> API name for the permission set
|
|
118
|
+
|
|
119
|
+
The API name for the generated permission set; also used to derive the output filename.
|
|
120
|
+
|
|
121
|
+
--include-record-types Include record type visibilities
|
|
122
|
+
|
|
123
|
+
Automatically include record type visibilities discovered from the source metadata, marked as visible by default.
|
|
124
|
+
|
|
125
|
+
--output=<value> Output directory
|
|
126
|
+
|
|
127
|
+
The directory to write the generated permission set XML file to.
|
|
128
|
+
|
|
129
|
+
--type=read-only|view-all|modify-all Baseline permission type
|
|
130
|
+
|
|
131
|
+
The baseline permission level to generate: 'read-only' grants read access to all discovered objects and fields,
|
|
132
|
+
'view-all' additionally grants view-all-records, and 'modify-all' grants full CRUD and modify-all-records access.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
_See code: [lib/commands/simply/permissions/build.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-permissions@1.2.31/packages/simply-permissions/lib/commands/simply/permissions/build.js)_
|
|
136
|
+
<!-- commandsstop -->
|
|
137
|
+
|
|
138
|
+
- [`sf simply permissions analyze`](#sf-simply-permissions-analyze)
|
|
139
|
+
- [`sf simply permissions build`](#sf-simply-permissions-build)
|
|
140
|
+
|
|
141
|
+
## `sf simply permissions analyze`
|
|
142
|
+
|
|
143
|
+
Analyze permission sets and permission set groups in an org.
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
USAGE
|
|
147
|
+
$ sf simply permissions analyze -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-f <value>...] [--output
|
|
148
|
+
<value>]
|
|
149
|
+
|
|
150
|
+
FLAGS
|
|
151
|
+
-f, --filter=<value>... Permission set or group names to include
|
|
152
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
153
|
+
configuration variable is already set.
|
|
154
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
155
|
+
--output=<value> [default: permissions_report.html] Output HTML file path
|
|
156
|
+
|
|
157
|
+
GLOBAL FLAGS
|
|
158
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
159
|
+
--json Format output as json.
|
|
160
|
+
|
|
161
|
+
DESCRIPTION
|
|
162
|
+
Analyze permission sets and permission set groups in an org.
|
|
163
|
+
|
|
164
|
+
Generates an HTML report of every permission set and permission set group in the target org, grouped by installed
|
|
165
|
+
package, including their object and field permissions.
|
|
166
|
+
|
|
167
|
+
EXAMPLES
|
|
168
|
+
$ sf simply permissions analyze --target-org myOrg
|
|
169
|
+
|
|
170
|
+
$ sf simply permissions analyze --target-org myOrg --output reports/permissions.html --filter My_Permission_Set --filter Another_Set
|
|
171
|
+
|
|
172
|
+
FLAG DESCRIPTIONS
|
|
173
|
+
-f, --filter=<value>... Permission set or group names to include
|
|
174
|
+
|
|
175
|
+
One or more PermissionSet (Name) or PermissionSetGroup (DeveloperName) API names to restrict the report to. If
|
|
176
|
+
omitted, all permission sets and groups are included.
|
|
177
|
+
|
|
178
|
+
--output=<value> Output HTML file path
|
|
179
|
+
|
|
180
|
+
The path to write the generated HTML report to.
|
|
181
|
+
```
|
|
182
|
+
|
|
68
183
|
_See code: [lib/commands/simply/permissions/analyze.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-permissions@1.2.13/packages/simply-permissions/lib/commands/simply/permissions/analyze.js)_
|
|
69
184
|
|
|
70
185
|
## `sf simply permissions build`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type PermissionAssignmentDeleteFailure = {
|
|
3
|
+
id: string;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
export type PermissionAssignmentDeleteResult = {
|
|
7
|
+
deleted: string[];
|
|
8
|
+
failures: PermissionAssignmentDeleteFailure[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Deletes every `PermissionSetAssignment` against the named `PermissionSet`s/`PermissionSetGroup`s
|
|
12
|
+
* — the pre-step a destructive metadata deploy of the permission set/group itself needs, so it
|
|
13
|
+
* doesn't fail or orphan assignments.
|
|
14
|
+
*/
|
|
15
|
+
export default class PermissionsAssignmentDelete extends SfCommand<PermissionAssignmentDeleteResult> {
|
|
16
|
+
static readonly summary: string;
|
|
17
|
+
static readonly description: string;
|
|
18
|
+
static readonly examples: string[];
|
|
19
|
+
static readonly flags: {
|
|
20
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'permission-set-name': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'permission-set-group-name': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined>;
|
|
24
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
25
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
};
|
|
27
|
+
/** @returns The deleted assignment Ids and any per-chunk failures. Sets `process.exitCode = 1` if any failure occurred. */
|
|
28
|
+
run(): Promise<PermissionAssignmentDeleteResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import fs from 'node:fs/promises';
|
|
17
|
+
import { Messages } from '@salesforce/core';
|
|
18
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
19
|
+
import { chunk, chunkedInQuery, readPackageManifestMembers } from '@simplysf/simply-core';
|
|
20
|
+
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-permissions', 'simply.permissions.assignment.delete');
|
|
23
|
+
/** How many names to put in each `IN (...)` clause, and how many Ids per DML delete chunk. */
|
|
24
|
+
const CHUNK_SIZE = 200;
|
|
25
|
+
const FAILURE_TABLE_COLUMNS = [
|
|
26
|
+
{ key: 'id', name: 'ASSIGNMENT ID' },
|
|
27
|
+
{ key: 'message', name: 'MESSAGE' },
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Deletes every `PermissionSetAssignment` against the named `PermissionSet`s/`PermissionSetGroup`s
|
|
31
|
+
* — the pre-step a destructive metadata deploy of the permission set/group itself needs, so it
|
|
32
|
+
* doesn't fail or orphan assignments.
|
|
33
|
+
*/
|
|
34
|
+
export default class PermissionsAssignmentDelete extends SfCommand {
|
|
35
|
+
static summary = messages.getMessage('summary');
|
|
36
|
+
static description = messages.getMessage('description');
|
|
37
|
+
static examples = messages.getMessages('examples');
|
|
38
|
+
static flags = {
|
|
39
|
+
...SfCommand.baseFlags,
|
|
40
|
+
...targetOrgFlags,
|
|
41
|
+
file: Flags.string({ summary: messages.getMessage('flags.file.summary'), char: 'f' }),
|
|
42
|
+
'permission-set-name': Flags.string({
|
|
43
|
+
summary: messages.getMessage('flags.permission-set-name.summary'),
|
|
44
|
+
multiple: true,
|
|
45
|
+
}),
|
|
46
|
+
'permission-set-group-name': Flags.string({
|
|
47
|
+
summary: messages.getMessage('flags.permission-set-group-name.summary'),
|
|
48
|
+
multiple: true,
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
/** @returns The deleted assignment Ids and any per-chunk failures. Sets `process.exitCode = 1` if any failure occurred. */
|
|
52
|
+
async run() {
|
|
53
|
+
const { flags } = await this.parse(PermissionsAssignmentDelete);
|
|
54
|
+
const hasExplicitNames = Boolean(flags['permission-set-name']?.length ?? flags['permission-set-group-name']?.length);
|
|
55
|
+
if ((flags.file && hasExplicitNames) || (!flags.file && !hasExplicitNames)) {
|
|
56
|
+
throw messages.createError('error.fileOrNameFlagsRequired');
|
|
57
|
+
}
|
|
58
|
+
let permissionSetNames;
|
|
59
|
+
let permissionSetGroupNames;
|
|
60
|
+
if (flags.file) {
|
|
61
|
+
const xmlContent = await fs.readFile(flags.file, 'utf-8');
|
|
62
|
+
permissionSetNames = readPackageManifestMembers(xmlContent, 'PermissionSet');
|
|
63
|
+
permissionSetGroupNames = readPackageManifestMembers(xmlContent, 'PermissionSetGroup');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
permissionSetNames = flags['permission-set-name'] ?? [];
|
|
67
|
+
permissionSetGroupNames = flags['permission-set-group-name'] ?? [];
|
|
68
|
+
}
|
|
69
|
+
if (permissionSetNames.length === 0 && permissionSetGroupNames.length === 0) {
|
|
70
|
+
this.info(messages.getMessage('info.nothingToDelete'));
|
|
71
|
+
return { deleted: [], failures: [] };
|
|
72
|
+
}
|
|
73
|
+
const connection = requireConnection(flags);
|
|
74
|
+
this.spinner.start(messages.getMessage('info.queryingAssignments'));
|
|
75
|
+
const [byPermissionSet, byPermissionSetGroup] = await Promise.all([
|
|
76
|
+
permissionSetNames.length > 0
|
|
77
|
+
? chunkedInQuery(connection, permissionSetNames, (inClause) => `SELECT Id FROM PermissionSetAssignment WHERE PermissionSet.Name IN (${inClause})`, { chunkSize: CHUNK_SIZE })
|
|
78
|
+
: [],
|
|
79
|
+
permissionSetGroupNames.length > 0
|
|
80
|
+
? chunkedInQuery(connection, permissionSetGroupNames, (inClause) => `SELECT Id FROM PermissionSetAssignment WHERE PermissionSetGroup.DeveloperName IN (${inClause})`, { chunkSize: CHUNK_SIZE })
|
|
81
|
+
: [],
|
|
82
|
+
]);
|
|
83
|
+
this.spinner.stop();
|
|
84
|
+
const assignmentIds = [...new Set([...byPermissionSet, ...byPermissionSetGroup].map((r) => r.Id))];
|
|
85
|
+
if (assignmentIds.length === 0) {
|
|
86
|
+
this.info(messages.getMessage('info.nothingToDelete'));
|
|
87
|
+
return { deleted: [], failures: [] };
|
|
88
|
+
}
|
|
89
|
+
this.spinner.start(messages.getMessage('info.deleting'));
|
|
90
|
+
const deleted = [];
|
|
91
|
+
const failures = [];
|
|
92
|
+
for (const idChunk of chunk(assignmentIds, CHUNK_SIZE)) {
|
|
93
|
+
// eslint-disable-next-line no-await-in-loop -- each chunk's DML delete must complete before the next chunk is sent
|
|
94
|
+
const results = await connection.sobject('PermissionSetAssignment').delete(idChunk);
|
|
95
|
+
// A failed SaveResult carries `id: undefined`, not the id that failed — the response array is
|
|
96
|
+
// positional against the request array, so the input chunk is the only reliable source of it.
|
|
97
|
+
results.forEach((result, index) => {
|
|
98
|
+
const id = idChunk[index];
|
|
99
|
+
if (result.success) {
|
|
100
|
+
deleted.push(id);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
failures.push({ id, message: result.errors.map((e) => e.message).join(', ') });
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
this.spinner.stop();
|
|
108
|
+
if (failures.length > 0) {
|
|
109
|
+
this.table({ data: failures, columns: FAILURE_TABLE_COLUMNS });
|
|
110
|
+
process.exitCode = 1;
|
|
111
|
+
}
|
|
112
|
+
this.info(messages.getMessage('info.summary', [deleted.length, failures.length]));
|
|
113
|
+
return { deleted, failures };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../src/commands/simply/permissions/assignment/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YA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ionSetAssignment` against the named `PermissionSet`s and/or `PermissionSetGroup`s — the pre-step a destructive metadata deploy of the permission set/group itself needs, so it doesn't fail or leave orphaned assignments behind.
|
|
8
|
+
|
|
9
|
+
Targets can be named either via `--file`, pointing at a `destructiveChanges.xml`/`package.xml`-shaped file whose `PermissionSet`/`PermissionSetGroup` type members are the targets, or via `--permission-set-name`/`--permission-set-group-name` flags (which may be combined with each other) for scripted or one-off use. `--file` is mutually exclusive with the two explicit-name flags.
|
|
10
|
+
|
|
11
|
+
# flags.file.summary
|
|
12
|
+
|
|
13
|
+
Path to a destructiveChanges.xml/package.xml-shaped file
|
|
14
|
+
|
|
15
|
+
# flags.permission-set-name.summary
|
|
16
|
+
|
|
17
|
+
PermissionSet Name(s) to delete assignments for
|
|
18
|
+
|
|
19
|
+
# flags.permission-set-group-name.summary
|
|
20
|
+
|
|
21
|
+
PermissionSetGroup DeveloperName(s) to delete assignments for
|
|
22
|
+
|
|
23
|
+
# examples
|
|
24
|
+
|
|
25
|
+
- <%= config.bin %> <%= command.id %> --file destructive/pre/destructiveChanges.xml --target-org myOrg
|
|
26
|
+
|
|
27
|
+
- <%= config.bin %> <%= command.id %> --permission-set-name My_Permission_Set --target-org myOrg
|
|
28
|
+
|
|
29
|
+
- <%= config.bin %> <%= command.id %> --permission-set-group-name My_Permission_Set_Group --target-org myOrg
|
|
30
|
+
|
|
31
|
+
# error.fileOrNameFlagsRequired
|
|
32
|
+
|
|
33
|
+
You must specify either --file, or --permission-set-name/--permission-set-group-name, but not both.
|
|
34
|
+
|
|
35
|
+
# info.nothingToDelete
|
|
36
|
+
|
|
37
|
+
No matching PermissionSetAssignments found; nothing to delete.
|
|
38
|
+
|
|
39
|
+
# info.queryingAssignments
|
|
40
|
+
|
|
41
|
+
Querying PermissionSetAssignments...
|
|
42
|
+
|
|
43
|
+
# info.deleting
|
|
44
|
+
|
|
45
|
+
Deleting PermissionSetAssignments...
|
|
46
|
+
|
|
47
|
+
# info.summary
|
|
48
|
+
|
|
49
|
+
Deleted %s assignment(s), %s failure(s).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysf/simply-permissions",
|
|
3
3
|
"description": "Utilities for working with permissions",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-node",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-node/issues",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@salesforce/kit": "^3.2.6",
|
|
62
62
|
"@salesforce/sf-plugins-core": "^12.2.16",
|
|
63
63
|
"@salesforce/source-deploy-retrieve": "^12.37.2",
|
|
64
|
-
"@simplysf/simply-core": "^1.
|
|
64
|
+
"@simplysf/simply-core": "^1.5.0",
|
|
65
65
|
"@simplysf/simply-plugin-kit": "^1.0.4",
|
|
66
66
|
"@simplysf/simply-report": "^1.0.3",
|
|
67
67
|
"handlebars": "^4.7.9",
|
|
@@ -212,5 +212,5 @@
|
|
|
212
212
|
"output": []
|
|
213
213
|
}
|
|
214
214
|
},
|
|
215
|
-
"gitHead": "
|
|
215
|
+
"gitHead": "7027cc7497e4b5852f51abb3713757f9eae85cd7"
|
|
216
216
|
}
|