generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulkify permset assign command #102
Closed
lukecotter
wants to merge
2
commits into
salesforcecli:main
from
lukecotter:feature/bulkify-permsset-assign
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,19 +69,20 @@ sfdx plugins | |
## Commands | ||
|
||
<!-- commands --> | ||
* [`sfdx force:user:create [name=value...] [-a <string>] [-f <string>] [-s] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceusercreate-namevalue--a-string--f-string--s--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx force:user:display [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserdisplay--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx force:user:list [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserlist--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx force:user:password:generate [-o <array>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserpasswordgenerate--o-array--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
* [`sfdx force:user:permset:assign -n <string> [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserpermsetassign--n-string--o-array--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
|
||
- [`sfdx force:user:create [name=value...] [-a <string>] [-f <string>] [-s] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceusercreate-namevalue--a-string--f-string--s--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
- [`sfdx force:user:display [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserdisplay--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
- [`sfdx force:user:list [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserlist--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
- [`sfdx force:user:password:generate [-o <array>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserpasswordgenerate--o-array--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
- [`sfdx force:user:permset:assign -n <array> [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forceuserpermsetassign--n-string--o-array--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal) | ||
|
||
## `sfdx force:user:create [name=value...] [-a <string>] [-f <string>] [-s] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
create a user for a scratch org | ||
|
||
``` | ||
USAGE | ||
$ sfdx force:user:create [name=value...] [-a <string>] [-f <string>] [-s] [-v <string>] [-u <string>] [--apiversion | ||
$ sfdx force:user:create [name=value...] [-a <string>] [-f <string>] [-s] [-v <string>] [-u <string>] [--apiversion | ||
<string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] | ||
|
||
OPTIONS | ||
|
@@ -110,7 +111,7 @@ OPTIONS | |
this command invocation | ||
|
||
DESCRIPTION | ||
Create a user for a scratch org, optionally setting an alias for use by the CLI, assigning permission sets (e.g., | ||
Create a user for a scratch org, optionally setting an alias for use by the CLI, assigning permission sets (e.g., | ||
permsets=ps1,ps2), generating a password (e.g., generatepassword=true), and setting User sObject fields. | ||
|
||
EXAMPLES | ||
|
@@ -128,7 +129,7 @@ displays information about a user of a scratch org | |
|
||
``` | ||
USAGE | ||
$ sfdx force:user:display [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
$ sfdx force:user:display [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] | ||
|
||
OPTIONS | ||
|
@@ -162,7 +163,7 @@ list all authenticated users of an org | |
|
||
``` | ||
USAGE | ||
$ sfdx force:user:list [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
$ sfdx force:user:list [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] | ||
|
||
OPTIONS | ||
|
@@ -197,7 +198,7 @@ generate a password for scratch org users | |
|
||
``` | ||
USAGE | ||
$ sfdx force:user:password:generate [-o <array>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] | ||
$ sfdx force:user:password:generate [-o <array>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] | ||
[--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] | ||
|
||
OPTIONS | ||
|
@@ -219,10 +220,10 @@ OPTIONS | |
this command invocation | ||
|
||
DESCRIPTION | ||
Generates and sets a random password for one or more scratch org users. Targets the usernames listed with the | ||
Generates and sets a random password for one or more scratch org users. Targets the usernames listed with the | ||
--onbehalfof parameter or the --targetusername parameter. Defaults to the defaultusername. | ||
|
||
If you haven’t set a default Dev Hub, or if your scratch org isn’t associated with your default Dev Hub, | ||
If you haven’t set a default Dev Hub, or if your scratch org isn’t associated with your default Dev Hub, | ||
--targetdevhubusername is required. | ||
|
||
To see a password that was previously generated, run "sfdx force:user:display". | ||
|
@@ -235,18 +236,18 @@ EXAMPLES | |
|
||
_See code: [src/commands/force/user/password/generate.ts](https://github.com/salesforcecli/plugin-user/blob/v1.2.7/src/commands/force/user/password/generate.ts)_ | ||
|
||
## `sfdx force:user:permset:assign -n <string> [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
## `sfdx force:user:permset:assign -n <array> [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]` | ||
|
||
assign a permission set to one or more users of an org | ||
|
||
``` | ||
USAGE | ||
$ sfdx force:user:permset:assign -n <string> [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
$ sfdx force:user:permset:assign -n <array> [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel | ||
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] | ||
|
||
OPTIONS | ||
-n, --permsetname=permsetname (required) the name of the | ||
permission set to assign | ||
-n, --permsetname=permsetname (required) comma-separated list of | ||
permission sets to assign | ||
|
||
-o, --onbehalfof=onbehalfof comma-separated list of usernames or | ||
aliases to assign the permission set | ||
|
@@ -266,8 +267,10 @@ OPTIONS | |
EXAMPLES | ||
sfdx force:user:permset:assign -n DreamHouse | ||
sfdx force:user:permset:assign -n DreamHouse -u [email protected] | ||
sfdx force:user:permset:assign -n "DreamHouse,LargeDreamHouse" -u [email protected] | ||
sfdx force:user:permset:assign -n DreamHouse -o "[email protected],user2,user3" | ||
``` | ||
|
||
_See code: [src/commands/force/user/permset/assign.ts](https://github.com/salesforcecli/plugin-user/blob/v1.2.7/src/commands/force/user/permset/assign.ts)_ | ||
|
||
<!-- commandsstop --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"description": "assign a permission set to one or more users of an org", | ||
"examples": [ | ||
"sfdx force:user:permset:assign -n DreamHouse", | ||
"sfdx force:user:permset:assign -n \"DreamHouse, LargeDreamHouse\"", | ||
"sfdx force:user:permset:assign -n DreamHouse -u [email protected]", | ||
"sfdx force:user:permset:assign -n DreamHouse -o \"[email protected],user2,user3\"" | ||
], | ||
"flags": { | ||
"onBehalfOf": "comma-separated list of usernames or aliases to assign the permission set to", | ||
"permsetName": "the name of the permission set to assign" | ||
"permsetName": "comma-separated list of permission sets to assign" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,18 +38,18 @@ describe('force:user:permset:assign', () => { | |
'--onbehalfof', | ||
'testAlias, [email protected]', | ||
'--permsetname', | ||
'DreamHouse', | ||
'DreamHouse, LargeDreamHouse', | ||
]) | ||
.it('should assign the one permset to both users', (ctx) => { | ||
.it('should assign both permsets to both users', (ctx) => { | ||
// [email protected] is aliased to testUser | ||
const expected = [ | ||
{ | ||
name: 'testAlias', | ||
value: 'DreamHouse', | ||
value: 'DreamHouse,LargeDreamHouse', | ||
}, | ||
{ | ||
name: '[email protected]', | ||
value: 'DreamHouse', | ||
value: 'DreamHouse,LargeDreamHouse', | ||
}, | ||
]; | ||
const result = JSON.parse(ctx.stdout).result; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if there's a standard around this, but it's been suggested to me to use
asArray
orasArray<string>
if necessary instead ofas string[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to change it, this pattern is also used at line 50 and in other files in the code base.
Want me to change others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint complains at me when I run build
I guess I should just leave it?