sfpowerscripts icon indicating copy to clipboard operation
sfpowerscripts copied to clipboard

Ability to automatically create users with defined roles & permissions for a scratch orgs in a pool

Open jonathankretzmer opened this issue 2 years ago • 0 comments

Describe the feature

We would like the ability to have a pre-defined set of users created for developers in scratch org as part of a scratch org pool preparation. The developers could then use the pre-configured user with all the appropriate profile and permission sets applied so as to more closely mimic UAT and Production behaviour. This will increase quality delivery as permission related issues will be picked up earlier in the SDLC.

Possible approach

  • Include a string array (or object array for future extensibility?) parameter in the scratch org pool def file.
  • Each would include a relative path to a user-def.json file describing the user and their profileName & permsets.
  • After the successful deployment to a scratch org, the list of users would be created
  • Upon fetching a scratch org a developer would be able to execute the following commands to get more details for the created users:
    • List the users within the scratch org: `sfdx force:user:list -u
    • To login details for a particular created user: sfdx force:user:describe -u <username>

Considerations

  • Uniqueness of Username. This is an optional field in the def file, so it could be recommended to leave it out else it would obviously fail
  • Documentation would need to be updated accordingly

jonathankretzmer avatar Apr 19 '22 09:04 jonathankretzmer