hardis:project:convert:profilestopermsets
Description
Command Behavior
Converts existing Salesforce Profiles into Permission Sets, facilitating a more granular and recommended security model.
This command helps in migrating permissions from Profiles to Permission Sets, which is a best practice for managing user access in Salesforce. It creates a new Permission Set for each specified Profile, adopting a naming convention of PS_PROFILENAME.
Key functionalities:
- Profile to Permission Set Conversion: Automatically extracts permissions from a Profile and creates a corresponding Permission Set.
- Naming Convention: New Permission Sets are named with a
PS_prefix followed by the Profile name (e.g.,PS_Standard_User). - Exclusion Filter: Allows you to exclude specific Profiles from the conversion process using the
--exceptflag.
Technical explanations
The command's technical implementation involves:
- External Plugin Integration: It relies on the
shane-sfdx-plugins(specifically thesf shane:profile:convertcommand) to perform the actual conversion. - File System Scan: It reads the contents of the
force-app/main/default/profilesdirectory to identify all available Profile metadata files. - Command Execution: For each identified Profile (that is not excluded), it constructs and executes the
sf shane:profile:convertcommand with the appropriate Profile name and desired Permission Set name. - Error Handling: Includes basic error handling for the external command execution.
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| debug -d |
boolean | Activate debug mode (more logs) | |||
| except -e |
option | List of filters | |||
| flags-dir | option | undefined | |||
| json | boolean | Format output as json. | |||
| skipauth | boolean | Skip authentication check when a default username is required | |||
| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration |
Examples
$ sf hardis:project:convert:profilestopermsets