Skip to content

Comments

Add script to copy Cloud Foundry user roles from source to target user#378

Merged
cweibel merged 4 commits intomainfrom
copy-user-org-and-space-roles
Jan 30, 2026
Merged

Add script to copy Cloud Foundry user roles from source to target user#378
cweibel merged 4 commits intomainfrom
copy-user-org-and-space-roles

Conversation

@cweibel
Copy link
Contributor

@cweibel cweibel commented Jan 29, 2026

Changes proposed in this pull request:

  • Adds a script to copy the org and space permissions from one CF user to another.
  • Based partially on the existing cf-get-user-roles.sh script
  • Works for users with the same username but different origins
  • Requires the executor of the script to be logged into the CF CLI with enough permissions to create users
  • There are several dry-mode variations to see the permissions of the source user and also list out the commands that would be run against the target user.
  • There is a --delete option which will delete the source user if the target user is successfully updated. This option needs to be specified at run time and is not the default. Beware there is no "undo" for this.
  • I have a particular user case in mind, however this script is being kept generic on purpose so it can be used potentially for other support-style purposes to adhoc copy permissions from one account to another.
  • This will not copy UAA group memberships. For example this script cannot copy cloud_controller.admin or cloud_controller.global_auditor roles. It can only copy roles that are set by using cf set-org-role and cf set-space-role commands
  • Copies over the odd edge case of organization_users memberships. This is not accessible via cf set-org-role and must be set with a cf curl command. The cg-ui and Stratos projects also had to account for this.
  • Part of https://github.com/cloud-gov/private/issues/2765

security considerations

None. Adds a new script which operators can use.

@cweibel cweibel requested a review from a team as a code owner January 29, 2026 17:23
cweibel and others added 3 commits January 29, 2026 15:38
Co-authored-by: Peter Burkholder <peter.burkholder@gsa.gov>
Signed-off-by: Chris Weibel <christopher.weibel@gmail.com>
@cweibel cweibel merged commit 40d3202 into main Jan 30, 2026
4 checks passed
@cweibel cweibel deleted the copy-user-org-and-space-roles branch January 30, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants