sf-plugin-permission-sets 0.0.0-dev.73 → 0.0.0-dev.75
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 +45 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Stop clicking through Setup to grant access. Commit a YAML file, open a PR, let
|
|
|
15
15
|
|
|
16
16
|
- [Why](#why)
|
|
17
17
|
- [Install](#install)
|
|
18
|
+
- [Org permissions](#org-permissions)
|
|
18
19
|
- [Quick start](#quick-start)
|
|
19
20
|
- [Permission files](#permission-files)
|
|
20
21
|
- [Organizing files](#organizing-files)
|
|
@@ -22,10 +23,10 @@ Stop clicking through Setup to grant access. Commit a YAML file, open a PR, let
|
|
|
22
23
|
- [Validations](#validations)
|
|
23
24
|
- [Commands](#commands)
|
|
24
25
|
- [GitHub Actions](#github-actions)
|
|
25
|
-
- [Inspiration & equivalents](#inspiration--equivalents)
|
|
26
26
|
- [Versioning](#versioning)
|
|
27
27
|
- [Architecture](#architecture)
|
|
28
28
|
- [Development](#development)
|
|
29
|
+
- [License](#license)
|
|
29
30
|
|
|
30
31
|
---
|
|
31
32
|
|
|
@@ -57,6 +58,25 @@ sf plugins install sf-plugin-permission-sets@x.y.z
|
|
|
57
58
|
|
|
58
59
|
Requires Salesforce CLI (`sf`) and Node.js 22.13+.
|
|
59
60
|
|
|
61
|
+
## Org permissions
|
|
62
|
+
|
|
63
|
+
What the user behind `--target-org` needs:
|
|
64
|
+
|
|
65
|
+
| Command | API Enabled | View Setup and Configuration | View Roles and Role Hierarchy | Assign Permission Sets |
|
|
66
|
+
| --- | :---: | :---: | :---: | :---: |
|
|
67
|
+
| `sf ps check` | - | - | - | - |
|
|
68
|
+
| `sf ps validate` | ✓ | ✓ | ✓ | - |
|
|
69
|
+
| `sf ps plan` | ✓ | ✓ | ✓ | - |
|
|
70
|
+
| `sf ps export` | ✓ | ✓ | ✓ | - |
|
|
71
|
+
| `sf ps apply` | ✓ | ✓ | ✓ | ✓ |
|
|
72
|
+
|
|
73
|
+
✓ Required, - Not required.
|
|
74
|
+
|
|
75
|
+
Two permission sets, so a pull request job cannot change the org:
|
|
76
|
+
|
|
77
|
+
- [PS_Plugin_Read](setup/permissionsets/PS_Plugin_Read.permissionset-meta.xml): reads permission set assignments.
|
|
78
|
+
- [PS_Plugin_Write](setup/permissionsets/PS_Plugin_Write.permissionset-meta.xml): reads and modifies permission set assignments.
|
|
79
|
+
|
|
60
80
|
## Quick start
|
|
61
81
|
|
|
62
82
|
```bash
|
|
@@ -217,8 +237,8 @@ Every run checks the files first. `check` runs the file checks with no org, and
|
|
|
217
237
|
| `sf ps check` | Static analysis of the files alone: schema, duplicates, conflicts, identifier shape. No org, no auth. |
|
|
218
238
|
| `sf ps validate` | Everything `check` does, plus resolving every user/permission set against the org. |
|
|
219
239
|
| `sf ps plan` | Compute and display the change set: a read-only preview of what `apply` would do. |
|
|
220
|
-
| `sf ps apply` | Reconcile the org. Honors `--mode`, prompts before deletes, enforces guardrails. |
|
|
221
240
|
| `sf ps export` | Generate YAML from the current org state to bootstrap adoption. |
|
|
241
|
+
| `sf ps apply` | Reconcile the org. Honors `--mode`, prompts before deletes, enforces guardrails. |
|
|
222
242
|
|
|
223
243
|
### `sf ps check`
|
|
224
244
|
|
|
@@ -311,27 +331,6 @@ Unchanged: 4 assignments (--show-unchanged to list).
|
|
|
311
331
|
Next: sf ps apply -o prod -f "permissions/*.yml" --mode sync
|
|
312
332
|
```
|
|
313
333
|
|
|
314
|
-
### `sf ps apply`
|
|
315
|
-
|
|
316
|
-
```
|
|
317
|
-
USAGE
|
|
318
|
-
$ sf ps apply -o <org> -f <glob>... [--mode <value>]
|
|
319
|
-
[--max-deletes <n>] [--dry-run] [--show-unchanged] [--no-prompt] [--json]
|
|
320
|
-
|
|
321
|
-
FLAGS
|
|
322
|
-
-o, --target-org=<org> (required)
|
|
323
|
-
-f, --file=<glob>... (required) YAML file(s) to read. Repeatable, globs expanded by the plugin.
|
|
324
|
-
--mode=<value> additive | destructive | sync [default: additive]
|
|
325
|
-
--max-deletes=<n> Abort if a run would remove more than n assignments. [default: 50]
|
|
326
|
-
--dry-run Resolve and diff, print what would happen, change nothing.
|
|
327
|
-
--show-unchanged List assignments that already match, instead of only counting them.
|
|
328
|
-
--no-prompt Skip the deletion confirmation prompt (for CI).
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
`apply` recomputes from the files every run: it re-reads the YAML, re-resolves every reference to an org id, and re-diffs against live state, then acts per `--mode`. Run `plan` shortly before `apply` so the preview you review reflects what `apply` will do (an edited file, a renamed permission set, or another admin's change between the two shifts the outcome).
|
|
332
|
-
|
|
333
|
-
Deletions always prompt for confirmation unless `--no-prompt` is set, and are hard-capped by `--max-deletes` so a bad merge can't unassign your whole org. DML is executed with the sObject Collections API and reports partial successes/failures per record.
|
|
334
|
-
|
|
335
334
|
### `sf ps export`
|
|
336
335
|
|
|
337
336
|
Read-only. Snapshots the org's current assignments as YAML you can commit and then feed back into the other commands. Writes to a file with `--output-file`, or to stdout when that flag is omitted.
|
|
@@ -371,10 +370,33 @@ sf ps export -o prod --output-file team.yml \
|
|
|
371
370
|
|
|
372
371
|
A requested `--user` that has no matching assignments (a typo, or a user who genuinely holds nothing in scope) is reported as a warning and the export continues with whoever matched, so a mistyped username never masquerades as a clean empty file.
|
|
373
372
|
|
|
373
|
+
### `sf ps apply`
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
USAGE
|
|
377
|
+
$ sf ps apply -o <org> -f <glob>... [--mode <value>]
|
|
378
|
+
[--max-deletes <n>] [--dry-run] [--show-unchanged] [--no-prompt] [--json]
|
|
379
|
+
|
|
380
|
+
FLAGS
|
|
381
|
+
-o, --target-org=<org> (required)
|
|
382
|
+
-f, --file=<glob>... (required) YAML file(s) to read. Repeatable, globs expanded by the plugin.
|
|
383
|
+
--mode=<value> additive | destructive | sync [default: additive]
|
|
384
|
+
--max-deletes=<n> Abort if a run would remove more than n assignments. [default: 50]
|
|
385
|
+
--dry-run Resolve and diff, print what would happen, change nothing.
|
|
386
|
+
--show-unchanged List assignments that already match, instead of only counting them.
|
|
387
|
+
--no-prompt Skip the deletion confirmation prompt (for CI).
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
`apply` recomputes from the files every run: it re-reads the YAML, re-resolves every reference to an org id, and re-diffs against live state, then acts per `--mode`. Run `plan` shortly before `apply` so the preview you review reflects what `apply` will do (an edited file, a renamed permission set, or another admin's change between the two shifts the outcome).
|
|
391
|
+
|
|
392
|
+
Deletions always prompt for confirmation unless `--no-prompt` is set, and are hard-capped by `--max-deletes` so a bad merge can't unassign your whole org. DML is executed with the sObject Collections API and reports partial successes/failures per record.
|
|
393
|
+
|
|
374
394
|
## GitHub Actions
|
|
375
395
|
|
|
376
396
|
Three small workflows that build on each other: check pull requests with no org at all, validate the same files against the real org, then apply on merge.
|
|
377
397
|
|
|
398
|
+
Point the pull request workflows at a `PS_Plugin_Read` user and only the merge workflow at `PS_Plugin_Write` (see [Org permissions](#org-permissions)).
|
|
399
|
+
|
|
378
400
|
**1. Check pull requests to main** (no org, no secrets):
|
|
379
401
|
|
|
380
402
|
```yaml
|
|
@@ -474,15 +496,6 @@ Workflows 2 and 3 share one secret. Get the auth URL once with `sf org display -
|
|
|
474
496
|
|
|
475
497
|
Want the diff on the PR before merging? Add a `sf ps plan --file "permissions/*.yml" --target-org prod` step to workflow 2, right after the login step, so reviewers see the change set that `apply` will carry out on merge.
|
|
476
498
|
|
|
477
|
-
## Inspiration & equivalents
|
|
478
|
-
|
|
479
|
-
This plugin's command surface borrows ideas from tools you already know:
|
|
480
|
-
|
|
481
|
-
- [Terraform](https://developer.hashicorp.com/terraform/docs)
|
|
482
|
-
- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/)
|
|
483
|
-
- [AWS SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/)
|
|
484
|
-
- [Salesforce CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm)
|
|
485
|
-
|
|
486
499
|
## Versioning
|
|
487
500
|
|
|
488
501
|
Releases follow [semantic versioning](https://semver.org). Snapshots are automatic, real releases are a manual decision.
|
|
@@ -563,7 +576,6 @@ cp .env.example .env
|
|
|
563
576
|
| --- | --- | --- |
|
|
564
577
|
| `PS_TARGET_ORG` | yes | Username or alias of an already-authenticated org. The `plan`, `apply`, and `export` specs run against it. |
|
|
565
578
|
|
|
566
|
-
|
|
567
579
|
## License
|
|
568
580
|
|
|
569
581
|
BSD-3-Clause © Isaac Ferreira
|
package/package.json
CHANGED