@simplysf/simply-permissions 1.4.4 → 1.6.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 +27 -6
- package/lib/commands/simply/permissions/build.d.ts +28 -6
- package/lib/commands/simply/permissions/build.js +95 -52
- package/lib/commands/simply/permissions/build.js.map +1 -1
- package/messages/simply.permissions.build.md +33 -3
- package/oclif.manifest.json +12 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ FLAG DESCRIPTIONS
|
|
|
66
66
|
The path to write the generated HTML report to.
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
_See code: [lib/commands/simply/permissions/analyze.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.
|
|
69
|
+
_See code: [lib/commands/simply/permissions/analyze.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.6.0/packages/simply-permissions/lib/commands/simply/permissions/analyze.js)_
|
|
70
70
|
|
|
71
71
|
## `sf simply permissions assignment delete`
|
|
72
72
|
|
|
@@ -109,7 +109,7 @@ EXAMPLES
|
|
|
109
109
|
$ sf simply permissions assignment delete --permission-set-group-name My_Permission_Set_Group --target-org myOrg
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
_See code: [lib/commands/simply/permissions/assignment/delete.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.
|
|
112
|
+
_See code: [lib/commands/simply/permissions/assignment/delete.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.6.0/packages/simply-permissions/lib/commands/simply/permissions/assignment/delete.js)_
|
|
113
113
|
|
|
114
114
|
## `sf simply permissions build`
|
|
115
115
|
|
|
@@ -119,12 +119,14 @@ Generate permission sets from Salesforce source metadata.
|
|
|
119
119
|
USAGE
|
|
120
120
|
$ sf simply permissions build [--json] [--flags-dir <value>] [-f <value> | --type read-only|view-all|modify-all | -n <value>
|
|
121
121
|
| -d <value> | --output <value> | -c <value> | --include-record-types | --label <value> | --description <value>]
|
|
122
|
+
[--check]
|
|
122
123
|
|
|
123
124
|
FLAGS
|
|
124
125
|
-c, --config=<value> Path to a permission set configuration file
|
|
125
126
|
-d, --directory=<value> Path to the Salesforce project directory
|
|
126
127
|
-f, --file=<value> Path to a permission sets file declaring every permission set to generate
|
|
127
128
|
-n, --name=<value> API name for the permission set
|
|
129
|
+
--check Check that the generated permission sets are up to date, without writing them
|
|
128
130
|
--description=<value> Description for the permission set
|
|
129
131
|
--include-record-types Include record type visibilities
|
|
130
132
|
--label=<value> Label for the permission set
|
|
@@ -150,7 +152,9 @@ DESCRIPTION
|
|
|
150
152
|
shared by every entry, and any entry can override them. An entry's "config" is either a path to a --config file or the
|
|
151
153
|
same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole
|
|
152
154
|
file, including referenced override files and source directories, is validated before anything is written, and each
|
|
153
|
-
source directory is scanned only once.
|
|
155
|
+
source directory is scanned only once. Name the file with the .psbuild.json suffix (for example
|
|
156
|
+
config/app.psbuild.json): that's how `sf simply cicd build check-permission-sets` finds permission sets files, and
|
|
157
|
+
this command warns about a file without it.
|
|
154
158
|
|
|
155
159
|
{
|
|
156
160
|
"defaults": {
|
|
@@ -174,6 +178,12 @@ DESCRIPTION
|
|
|
174
178
|
]
|
|
175
179
|
}
|
|
176
180
|
|
|
181
|
+
To check in CI that the committed permission sets still match their source metadata, add --check. It builds each
|
|
182
|
+
permission set as usual but writes nothing: it compares each one with the file already at its output path and reports
|
|
183
|
+
it as "up-to-date", "drifted", or "missing". If any permission set has drifted or is missing, the command exits with
|
|
184
|
+
code 1. Formatting differences, such as indentation, line endings, or comments, don't count as drift, so files
|
|
185
|
+
reformatted by Prettier still pass. Any other difference does, including hand edits and reordered entries.
|
|
186
|
+
|
|
177
187
|
EXAMPLES
|
|
178
188
|
$ sf simply permissions build --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets
|
|
179
189
|
|
|
@@ -181,7 +191,11 @@ EXAMPLES
|
|
|
181
191
|
|
|
182
192
|
Regenerate every permission set declared in a permission sets file:
|
|
183
193
|
|
|
184
|
-
$ sf simply permissions build --file config/
|
|
194
|
+
$ sf simply permissions build --file config/app.psbuild.json
|
|
195
|
+
|
|
196
|
+
In CI, fail if any permission set declared in a permission sets file needs to be regenerated:
|
|
197
|
+
|
|
198
|
+
$ sf simply permissions build --file config/app.psbuild.json --check
|
|
185
199
|
|
|
186
200
|
FLAG DESCRIPTIONS
|
|
187
201
|
-c, --config=<value> Path to a permission set configuration file
|
|
@@ -198,13 +212,20 @@ FLAG DESCRIPTIONS
|
|
|
198
212
|
|
|
199
213
|
The path to a JSON file with a "permissionSets" array, each entry describing one permission set to generate ("name",
|
|
200
214
|
"type", and optionally "label", "description", "directory", "output", "includeRecordTypes", "config"), and an
|
|
201
|
-
optional "defaults" object.
|
|
215
|
+
optional "defaults" object. Name it with the .psbuild.json suffix; any other name works but prints a warning. Can't
|
|
216
|
+
be combined with the flags that describe a single permission set.
|
|
202
217
|
|
|
203
218
|
-n, --name=<value> API name for the permission set
|
|
204
219
|
|
|
205
220
|
The API name for the generated permission set; also used to derive the output filename. Required unless --file is
|
|
206
221
|
used.
|
|
207
222
|
|
|
223
|
+
--check Check that the generated permission sets are up to date, without writing them
|
|
224
|
+
|
|
225
|
+
Instead of writing each permission set, compare what would be generated with the file already at its output path.
|
|
226
|
+
Exits with code 1 if any permission set has drifted or is missing. Works with --file and with the
|
|
227
|
+
single-permission-set flags.
|
|
228
|
+
|
|
208
229
|
--include-record-types Include record type visibilities
|
|
209
230
|
|
|
210
231
|
Automatically include record type visibilities discovered from the source metadata, marked as visible by default.
|
|
@@ -220,7 +241,7 @@ FLAG DESCRIPTIONS
|
|
|
220
241
|
Required unless --file is used.
|
|
221
242
|
```
|
|
222
243
|
|
|
223
|
-
_See code: [lib/commands/simply/permissions/build.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.
|
|
244
|
+
_See code: [lib/commands/simply/permissions/build.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.6.0/packages/simply-permissions/lib/commands/simply/permissions/build.js)_
|
|
224
245
|
<!-- commandsstop -->
|
|
225
246
|
|
|
226
247
|
## Configuration Files
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { PermissionSetBuildResult, PermissionSetType } from '@simplysf/simply-permissions-core';
|
|
3
|
-
/**
|
|
4
|
-
|
|
2
|
+
import { PermissionSetBuildResult, PermissionSetCheckStatus, PermissionSetType } from '@simplysf/simply-permissions-core';
|
|
3
|
+
/** One permission set's output path and permission counts; with `--check`, also whether the file there matches. */
|
|
4
|
+
type PermissionsBuildEntry = PermissionSetBuildResult & {
|
|
5
|
+
status?: PermissionSetCheckStatus;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Where a single generated permission set was written (or, with `--check`, would be), and how many
|
|
9
|
+
* permissions it grants. With `--check`, `status` says whether the file there matches.
|
|
10
|
+
*/
|
|
11
|
+
export type PermissionsBuildResult = Omit<PermissionsBuildEntry, 'name'>;
|
|
5
12
|
/** With `--file`: one entry per permission set declared in the file, in file order. */
|
|
6
|
-
export type PermissionsBuildFileResult =
|
|
13
|
+
export type PermissionsBuildFileResult = PermissionsBuildEntry[];
|
|
14
|
+
/** `file` renamed to carry {@link PERMISSION_SETS_FILE_SUFFIX}: `.psbuild` before a `.json` extension, or the whole suffix appended. */
|
|
15
|
+
export declare function suffixedName(file: string): string;
|
|
7
16
|
/**
|
|
8
17
|
* Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally)
|
|
9
18
|
* record types, then generates a permission set XML file with a baseline of permissions
|
|
@@ -13,6 +22,9 @@ export type PermissionsBuildFileResult = PermissionSetBuildResult[];
|
|
|
13
22
|
*
|
|
14
23
|
* With `--file`, generates every permission set declared in a JSON permission sets file instead,
|
|
15
24
|
* validating the whole file before writing anything.
|
|
25
|
+
*
|
|
26
|
+
* With `--check`, writes nothing: compares each permission set it would generate with the file
|
|
27
|
+
* already at its output path, and sets `process.exitCode = 1` if any has drifted or is missing.
|
|
16
28
|
*/
|
|
17
29
|
export default class PermissionsBuild extends SfCommand<PermissionsBuildResult | PermissionsBuildFileResult> {
|
|
18
30
|
static readonly summary: string;
|
|
@@ -28,9 +40,19 @@ export default class PermissionsBuild extends SfCommand<PermissionsBuildResult |
|
|
|
28
40
|
'include-record-types': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
41
|
label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
42
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
43
|
+
check: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
31
44
|
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
45
|
};
|
|
33
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* @returns The output file path and object/field permission counts — or, with `--file`, one such entry (plus its name) per permission set.
|
|
48
|
+
* With `--check`, each also has a `status`, and `process.exitCode` is set to 1 when any isn't `up-to-date`.
|
|
49
|
+
*/
|
|
34
50
|
run(): Promise<PermissionsBuildResult | PermissionsBuildFileResult>;
|
|
35
|
-
|
|
51
|
+
/** Resolves the single-permission-set flags into a spec, reporting every missing required flag at once. */
|
|
52
|
+
private singleSpec;
|
|
53
|
+
private generate;
|
|
54
|
+
private check;
|
|
55
|
+
private readConfig;
|
|
56
|
+
private startSpinner;
|
|
36
57
|
}
|
|
58
|
+
export {};
|
|
@@ -15,9 +15,20 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
17
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
-
import { generatePermissionSets, loadPermissionSetBuildConfig, loadPermissionSetsFile, PermissionSetBuildError, } from '@simplysf/simply-permissions-core';
|
|
18
|
+
import { checkPermissionSets, generatePermissionSets, loadPermissionSetBuildConfig, loadPermissionSetsFile, PermissionSetBuildError, } from '@simplysf/simply-permissions-core';
|
|
19
19
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
20
|
const messages = Messages.loadMessages('@simplysf/simply-permissions', 'simply.permissions.build');
|
|
21
|
+
/**
|
|
22
|
+
* The suffix that marks a permission sets file, which is how `sf simply cicd build check-permission-sets`
|
|
23
|
+
* finds them. Also defined in `simply-cicd`.
|
|
24
|
+
*/
|
|
25
|
+
const PERMISSION_SETS_FILE_SUFFIX = '.psbuild.json';
|
|
26
|
+
/** `file` renamed to carry {@link PERMISSION_SETS_FILE_SUFFIX}: `.psbuild` before a `.json` extension, or the whole suffix appended. */
|
|
27
|
+
export function suffixedName(file) {
|
|
28
|
+
return file.endsWith('.json')
|
|
29
|
+
? `${file.slice(0, -'.json'.length)}${PERMISSION_SETS_FILE_SUFFIX}`
|
|
30
|
+
: `${file}${PERMISSION_SETS_FILE_SUFFIX}`;
|
|
31
|
+
}
|
|
21
32
|
/** The flags that describe a single permission set, and so can't be combined with `--file`. */
|
|
22
33
|
const SINGLE_PERMISSION_SET_FLAGS = [
|
|
23
34
|
'type',
|
|
@@ -29,6 +40,12 @@ const SINGLE_PERMISSION_SET_FLAGS = [
|
|
|
29
40
|
'label',
|
|
30
41
|
'description',
|
|
31
42
|
];
|
|
43
|
+
const TABLE_COLUMNS = [
|
|
44
|
+
{ key: 'name', name: 'NAME' },
|
|
45
|
+
{ key: 'path', name: 'PATH' },
|
|
46
|
+
{ key: 'objectPermissionCount', name: 'OBJECT PERMISSIONS' },
|
|
47
|
+
{ key: 'fieldPermissionCount', name: 'FIELD PERMISSIONS' },
|
|
48
|
+
];
|
|
32
49
|
/** Maps `PermissionSetBuildError`'s structural codes to this command's own `Messages` catalog. */
|
|
33
50
|
function toCliError(error) {
|
|
34
51
|
switch (error.code) {
|
|
@@ -51,6 +68,9 @@ function toCliError(error) {
|
|
|
51
68
|
*
|
|
52
69
|
* With `--file`, generates every permission set declared in a JSON permission sets file instead,
|
|
53
70
|
* validating the whole file before writing anything.
|
|
71
|
+
*
|
|
72
|
+
* With `--check`, writes nothing: compares each permission set it would generate with the file
|
|
73
|
+
* already at its output path, and sets `process.exitCode = 1` if any has drifted or is missing.
|
|
54
74
|
*/
|
|
55
75
|
export default class PermissionsBuild extends SfCommand {
|
|
56
76
|
static summary = messages.getMessage('summary');
|
|
@@ -103,71 +123,94 @@ export default class PermissionsBuild extends SfCommand {
|
|
|
103
123
|
description: Flags.string({
|
|
104
124
|
summary: messages.getMessage('flags.description.summary'),
|
|
105
125
|
}),
|
|
126
|
+
check: Flags.boolean({
|
|
127
|
+
summary: messages.getMessage('flags.check.summary'),
|
|
128
|
+
description: messages.getMessage('flags.check.description'),
|
|
129
|
+
default: false,
|
|
130
|
+
}),
|
|
106
131
|
};
|
|
107
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* @returns The output file path and object/field permission counts — or, with `--file`, one such entry (plus its name) per permission set.
|
|
134
|
+
* With `--check`, each also has a `status`, and `process.exitCode` is set to 1 when any isn't `up-to-date`.
|
|
135
|
+
*/
|
|
108
136
|
async run() {
|
|
109
137
|
const { flags } = await this.parse(PermissionsBuild);
|
|
110
138
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const { type, name, directory, output } = flags;
|
|
115
|
-
if (!type || !name || !directory || !output) {
|
|
116
|
-
const missing = Object.entries({ type, name, directory, output })
|
|
117
|
-
.filter(([, value]) => !value)
|
|
118
|
-
.map(([flag]) => `--${flag}`);
|
|
119
|
-
throw messages.createError('error.missingRequiredFlags', [missing.join(', ')]);
|
|
139
|
+
const { file } = flags;
|
|
140
|
+
if (file && !file.endsWith(PERMISSION_SETS_FILE_SUFFIX)) {
|
|
141
|
+
this.warn(messages.getMessage('warning.unsuffixedFile', [file, suffixedName(file)]));
|
|
120
142
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.spinner.stop();
|
|
143
|
+
const specs = file ? await this.readConfig(() => loadPermissionSetsFile(file)) : await this.singleSpec(flags);
|
|
144
|
+
const results = flags.check ? await this.check(specs) : await this.generate(specs, Boolean(file));
|
|
145
|
+
if (file) {
|
|
146
|
+
return results;
|
|
126
147
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
label: flags.label,
|
|
132
|
-
description: flags.description,
|
|
133
|
-
includeRecordTypes: flags['include-record-types'],
|
|
134
|
-
config,
|
|
135
|
-
directory,
|
|
136
|
-
output,
|
|
137
|
-
},
|
|
138
|
-
], () => this.spinner.start(messages.getMessage('info.buildingPermissionSet', [name])));
|
|
139
|
-
this.spinner.stop();
|
|
140
|
-
this.info(messages.getMessage('info.fileGenerated', [built.path]));
|
|
141
|
-
return {
|
|
142
|
-
path: built.path,
|
|
143
|
-
objectPermissionCount: built.objectPermissionCount,
|
|
144
|
-
fieldPermissionCount: built.fieldPermissionCount,
|
|
145
|
-
};
|
|
148
|
+
// Single-set mode has never included `name` in its result.
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
150
|
+
const { name, ...result } = results[0];
|
|
151
|
+
return result;
|
|
146
152
|
}
|
|
147
153
|
catch (error) {
|
|
148
154
|
throw error instanceof PermissionSetBuildError ? toCliError(error) : error;
|
|
149
155
|
}
|
|
150
156
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
157
|
+
/** Resolves the single-permission-set flags into a spec, reporting every missing required flag at once. */
|
|
158
|
+
async singleSpec(flags) {
|
|
159
|
+
const { type, name, directory, output, config } = flags;
|
|
160
|
+
if (!type || !name || !directory || !output) {
|
|
161
|
+
const missing = Object.entries({ type, name, directory, output })
|
|
162
|
+
.filter(([, value]) => !value)
|
|
163
|
+
.map(([flag]) => `--${flag}`);
|
|
164
|
+
throw messages.createError('error.missingRequiredFlags', [missing.join(', ')]);
|
|
165
|
+
}
|
|
166
|
+
return [
|
|
167
|
+
{
|
|
168
|
+
type,
|
|
169
|
+
name,
|
|
170
|
+
label: flags.label,
|
|
171
|
+
description: flags.description,
|
|
172
|
+
includeRecordTypes: flags['include-record-types'],
|
|
173
|
+
config: config ? await this.readConfig(() => loadPermissionSetBuildConfig(config)) : undefined,
|
|
174
|
+
directory,
|
|
175
|
+
output,
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
async generate(specs, fromFile) {
|
|
180
|
+
const results = await generatePermissionSets(specs, (name) => this.startSpinner('info.buildingPermissionSet', name));
|
|
154
181
|
this.spinner.stop();
|
|
155
|
-
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
158
|
-
}
|
|
182
|
+
if (fromFile) {
|
|
183
|
+
this.table({ data: results, columns: TABLE_COLUMNS });
|
|
184
|
+
this.info(messages.getMessage('info.filesGenerated', [results.length]));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.info(messages.getMessage('info.fileGenerated', [results[0].path]));
|
|
188
|
+
}
|
|
189
|
+
return results;
|
|
190
|
+
}
|
|
191
|
+
async check(specs) {
|
|
192
|
+
const results = await checkPermissionSets(specs, (name) => this.startSpinner('info.checkingPermissionSet', name));
|
|
159
193
|
this.spinner.stop();
|
|
160
|
-
this.table({
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
this.info(messages.getMessage('info.filesGenerated', [results.length]));
|
|
194
|
+
this.table({ data: results, columns: [...TABLE_COLUMNS, { key: 'status', name: 'STATUS' }] });
|
|
195
|
+
const stale = results.filter((result) => result.status !== 'up-to-date').length;
|
|
196
|
+
if (stale > 0) {
|
|
197
|
+
this.warn(messages.getMessage('warning.drifted', [stale, results.length]));
|
|
198
|
+
process.exitCode = 1;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.info(messages.getMessage('info.upToDate', [results.length]));
|
|
202
|
+
}
|
|
170
203
|
return results;
|
|
171
204
|
}
|
|
205
|
+
async readConfig(load) {
|
|
206
|
+
this.spinner.start(messages.getMessage('info.readingConfig'));
|
|
207
|
+
const loaded = await load();
|
|
208
|
+
this.spinner.stop();
|
|
209
|
+
return loaded;
|
|
210
|
+
}
|
|
211
|
+
startSpinner(key, name) {
|
|
212
|
+
this.spinner.stop();
|
|
213
|
+
this.spinner.start(messages.getMessage(key, [name]));
|
|
214
|
+
}
|
|
172
215
|
}
|
|
173
216
|
//# sourceMappingURL=build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/commands/simply/permissions/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/commands/simply/permissions/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,GAKxB,MAAM,mCAAmC,CAAC;AAE3C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,8BAA8B,EAAE,0BAA0B,CAAC,CAAC;AAYnG;;;G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,CAAC;IAEO,KAAK,CAAC,UAAU,CAAI,IAAsB;QAChD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,YAAY,CAAC,GAAW,EAAE,IAAY;QAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC"}
|
|
@@ -6,7 +6,7 @@ Generate permission sets from Salesforce source metadata.
|
|
|
6
6
|
|
|
7
7
|
Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally) record types, then generates a permission set XML file with a baseline of permissions determined by --type. An optional JSON --config file can override individual object, field, tab, record type, and user permission settings, as well as whether the permission set requires activation.
|
|
8
8
|
|
|
9
|
-
To regenerate every permission set in a project with one command, declare them all in a JSON file and pass it with --file instead of the other flags. Each entry in the file's "permissionSets" array takes the same settings as one run of this command; a top-level "defaults" object supplies the "directory", "output", and "includeRecordTypes" values shared by every entry, and any entry can override them. An entry's "config" is either a path to a --config file or the same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole file, including referenced override files and source directories, is validated before anything is written, and each source directory is scanned only once.
|
|
9
|
+
To regenerate every permission set in a project with one command, declare them all in a JSON file and pass it with --file instead of the other flags. Each entry in the file's "permissionSets" array takes the same settings as one run of this command; a top-level "defaults" object supplies the "directory", "output", and "includeRecordTypes" values shared by every entry, and any entry can override them. An entry's "config" is either a path to a --config file or the same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole file, including referenced override files and source directories, is validated before anything is written, and each source directory is scanned only once. Name the file with the .psbuild.json suffix (for example config/app.psbuild.json): that's how `sf simply cicd build check-permission-sets` finds permission sets files, and this command warns about a file without it.
|
|
10
10
|
|
|
11
11
|
{
|
|
12
12
|
"defaults": {
|
|
@@ -30,13 +30,15 @@ To regenerate every permission set in a project with one command, declare them a
|
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
To check in CI that the committed permission sets still match their source metadata, add --check. It builds each permission set as usual but writes nothing: it compares each one with the file already at its output path and reports it as "up-to-date", "drifted", or "missing". If any permission set has drifted or is missing, the command exits with code 1. Formatting differences, such as indentation, line endings, or comments, don't count as drift, so files reformatted by Prettier still pass. Any other difference does, including hand edits and reordered entries.
|
|
34
|
+
|
|
33
35
|
# flags.file.summary
|
|
34
36
|
|
|
35
37
|
Path to a permission sets file declaring every permission set to generate
|
|
36
38
|
|
|
37
39
|
# flags.file.description
|
|
38
40
|
|
|
39
|
-
The path to a JSON file with a "permissionSets" array, each entry describing one permission set to generate ("name", "type", and optionally "label", "description", "directory", "output", "includeRecordTypes", "config"), and an optional "defaults" object. Can't be combined with the flags that describe a single permission set.
|
|
41
|
+
The path to a JSON file with a "permissionSets" array, each entry describing one permission set to generate ("name", "type", and optionally "label", "description", "directory", "output", "includeRecordTypes", "config"), and an optional "defaults" object. Name it with the .psbuild.json suffix; any other name works but prints a warning. Can't be combined with the flags that describe a single permission set.
|
|
40
42
|
|
|
41
43
|
# flags.type.summary
|
|
42
44
|
|
|
@@ -94,6 +96,14 @@ Label for the permission set
|
|
|
94
96
|
|
|
95
97
|
Description for the permission set
|
|
96
98
|
|
|
99
|
+
# flags.check.summary
|
|
100
|
+
|
|
101
|
+
Check that the generated permission sets are up to date, without writing them
|
|
102
|
+
|
|
103
|
+
# flags.check.description
|
|
104
|
+
|
|
105
|
+
Instead of writing each permission set, compare what would be generated with the file already at its output path. Exits with code 1 if any permission set has drifted or is missing. Works with --file and with the single-permission-set flags.
|
|
106
|
+
|
|
97
107
|
# examples
|
|
98
108
|
|
|
99
109
|
- <%= config.bin %> <%= command.id %> --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets
|
|
@@ -102,7 +112,11 @@ Description for the permission set
|
|
|
102
112
|
|
|
103
113
|
- Regenerate every permission set declared in a permission sets file:
|
|
104
114
|
|
|
105
|
-
<%= config.bin %> <%= command.id %> --file config/
|
|
115
|
+
<%= config.bin %> <%= command.id %> --file config/app.psbuild.json
|
|
116
|
+
|
|
117
|
+
- In CI, fail if any permission set declared in a permission sets file needs to be regenerated:
|
|
118
|
+
|
|
119
|
+
<%= config.bin %> <%= command.id %> --file config/app.psbuild.json --check
|
|
106
120
|
|
|
107
121
|
# error.missingRequiredFlags
|
|
108
122
|
|
|
@@ -139,3 +153,19 @@ Permission set successfully generated at %s
|
|
|
139
153
|
# info.filesGenerated
|
|
140
154
|
|
|
141
155
|
Successfully generated %s permission set(s).
|
|
156
|
+
|
|
157
|
+
# info.checkingPermissionSet
|
|
158
|
+
|
|
159
|
+
Checking permission set %s...
|
|
160
|
+
|
|
161
|
+
# info.upToDate
|
|
162
|
+
|
|
163
|
+
All %s permission set(s) are up to date.
|
|
164
|
+
|
|
165
|
+
# warning.drifted
|
|
166
|
+
|
|
167
|
+
%s of %s permission set(s) have drifted from their source metadata or are missing. Run this command without --check to regenerate them.
|
|
168
|
+
|
|
169
|
+
# warning.unsuffixedFile
|
|
170
|
+
|
|
171
|
+
%s doesn't end in .psbuild.json, so `sf simply cicd build check-permission-sets` won't find it. Rename it to %s.
|
package/oclif.manifest.json
CHANGED
|
@@ -90,11 +90,12 @@
|
|
|
90
90
|
"simply:permissions:build": {
|
|
91
91
|
"aliases": [],
|
|
92
92
|
"args": {},
|
|
93
|
-
"description": "Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally) record types, then generates a permission set XML file with a baseline of permissions determined by --type. An optional JSON --config file can override individual object, field, tab, record type, and user permission settings, as well as whether the permission set requires activation.\n\nTo regenerate every permission set in a project with one command, declare them all in a JSON file and pass it with --file instead of the other flags. Each entry in the file's \"permissionSets\" array takes the same settings as one run of this command; a top-level \"defaults\" object supplies the \"directory\", \"output\", and \"includeRecordTypes\" values shared by every entry, and any entry can override them. An entry's \"config\" is either a path to a --config file or the same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole file, including referenced override files and source directories, is validated before anything is written, and each source directory is scanned only once.\n\n {\n \"defaults\": {\n \"directory\": \"force-app\",\n \"output\": \"force-app/main/default/permissionsets\"\n },\n \"permissionSets\": [\n { \"name\": \"App_Read_Only\", \"type\": \"read-only\" },\n {\n \"name\": \"App_Admin\",\n \"type\": \"modify-all\",\n \"label\": \"App Admin\",\n \"includeRecordTypes\": true,\n \"config\": \"config/app-admin-overrides.json\"\n },\n {\n \"name\": \"App_Support\",\n \"type\": \"view-all\",\n \"config\": { \"userPermissions\": { \"ViewSetup\": true } }\n }\n ]\n }",
|
|
93
|
+
"description": "Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally) record types, then generates a permission set XML file with a baseline of permissions determined by --type. An optional JSON --config file can override individual object, field, tab, record type, and user permission settings, as well as whether the permission set requires activation.\n\nTo regenerate every permission set in a project with one command, declare them all in a JSON file and pass it with --file instead of the other flags. Each entry in the file's \"permissionSets\" array takes the same settings as one run of this command; a top-level \"defaults\" object supplies the \"directory\", \"output\", and \"includeRecordTypes\" values shared by every entry, and any entry can override them. An entry's \"config\" is either a path to a --config file or the same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole file, including referenced override files and source directories, is validated before anything is written, and each source directory is scanned only once. Name the file with the .psbuild.json suffix (for example config/app.psbuild.json): that's how `sf simply cicd build check-permission-sets` finds permission sets files, and this command warns about a file without it.\n\n {\n \"defaults\": {\n \"directory\": \"force-app\",\n \"output\": \"force-app/main/default/permissionsets\"\n },\n \"permissionSets\": [\n { \"name\": \"App_Read_Only\", \"type\": \"read-only\" },\n {\n \"name\": \"App_Admin\",\n \"type\": \"modify-all\",\n \"label\": \"App Admin\",\n \"includeRecordTypes\": true,\n \"config\": \"config/app-admin-overrides.json\"\n },\n {\n \"name\": \"App_Support\",\n \"type\": \"view-all\",\n \"config\": { \"userPermissions\": { \"ViewSetup\": true } }\n }\n ]\n }\n\nTo check in CI that the committed permission sets still match their source metadata, add --check. It builds each permission set as usual but writes nothing: it compares each one with the file already at its output path and reports it as \"up-to-date\", \"drifted\", or \"missing\". If any permission set has drifted or is missing, the command exits with code 1. Formatting differences, such as indentation, line endings, or comments, don't count as drift, so files reformatted by Prettier still pass. Any other difference does, including hand edits and reordered entries.",
|
|
94
94
|
"examples": [
|
|
95
95
|
"<%= config.bin %> <%= command.id %> --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets",
|
|
96
96
|
"<%= config.bin %> <%= command.id %> --type modify-all --name My_Admin_Access --directory force-app --config config/permission-overrides.json --output force-app/main/default/permissionsets --include-record-types",
|
|
97
|
-
"Regenerate every permission set declared in a permission sets file:\n<%= config.bin %> <%= command.id %> --file config/
|
|
97
|
+
"Regenerate every permission set declared in a permission sets file:\n<%= config.bin %> <%= command.id %> --file config/app.psbuild.json",
|
|
98
|
+
"In CI, fail if any permission set declared in a permission sets file needs to be regenerated:\n<%= config.bin %> <%= command.id %> --file config/app.psbuild.json --check"
|
|
98
99
|
],
|
|
99
100
|
"flags": {
|
|
100
101
|
"json": {
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
},
|
|
115
116
|
"file": {
|
|
116
117
|
"char": "f",
|
|
117
|
-
"description": "The path to a JSON file with a \"permissionSets\" array, each entry describing one permission set to generate (\"name\", \"type\", and optionally \"label\", \"description\", \"directory\", \"output\", \"includeRecordTypes\", \"config\"), and an optional \"defaults\" object. Can't be combined with the flags that describe a single permission set.",
|
|
118
|
+
"description": "The path to a JSON file with a \"permissionSets\" array, each entry describing one permission set to generate (\"name\", \"type\", and optionally \"label\", \"description\", \"directory\", \"output\", \"includeRecordTypes\", \"config\"), and an optional \"defaults\" object. Name it with the .psbuild.json suffix; any other name works but prints a warning. Can't be combined with the flags that describe a single permission set.",
|
|
118
119
|
"exclusive": [
|
|
119
120
|
"type",
|
|
120
121
|
"name",
|
|
@@ -199,6 +200,13 @@
|
|
|
199
200
|
"hasDynamicHelp": false,
|
|
200
201
|
"multiple": false,
|
|
201
202
|
"type": "option"
|
|
203
|
+
},
|
|
204
|
+
"check": {
|
|
205
|
+
"description": "Instead of writing each permission set, compare what would be generated with the file already at its output path. Exits with code 1 if any permission set has drifted or is missing. Works with --file and with the single-permission-set flags.",
|
|
206
|
+
"name": "check",
|
|
207
|
+
"summary": "Check that the generated permission sets are up to date, without writing them",
|
|
208
|
+
"allowNo": false,
|
|
209
|
+
"type": "boolean"
|
|
202
210
|
}
|
|
203
211
|
},
|
|
204
212
|
"hasDynamicHelp": false,
|
|
@@ -340,5 +348,5 @@
|
|
|
340
348
|
]
|
|
341
349
|
}
|
|
342
350
|
},
|
|
343
|
-
"version": "1.
|
|
351
|
+
"version": "1.6.0"
|
|
344
352
|
}
|
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.6.0",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-plugins",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-plugins/issues",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@salesforce/sf-plugins-core": "^12.2.16",
|
|
63
63
|
"@salesforce/source-deploy-retrieve": "^12.37.2",
|
|
64
64
|
"@simplysf/simply-core": "^1.6.7",
|
|
65
|
-
"@simplysf/simply-permissions-core": "^0.
|
|
65
|
+
"@simplysf/simply-permissions-core": "^0.4.0",
|
|
66
66
|
"@simplysf/simply-plugin-kit": "^1.0.9",
|
|
67
67
|
"zod": "^4.6.5"
|
|
68
68
|
},
|
|
@@ -202,5 +202,5 @@
|
|
|
202
202
|
"output": []
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
|
-
"gitHead": "
|
|
205
|
+
"gitHead": "cfc320bc665f61d2ab5c702ea9120bddc34b6078"
|
|
206
206
|
}
|