0

I want to remove all the roles assigned to the user(Space auditor, space manager, org manager, ect.,) , without deleting his ID with "cf delete-user", I want their ID still to exist with the uaac but remove all cloudfoundry roles alone, is there a code /command for that?

OBED
  • 1
  • I mean as a admin I have access to all org/spcae and env, so is there any command like "cf remove-roles" that will remove all user roles for the user? or a way I can accomplish it with code or something – OBED Sep 20 '22 at 14:06
  • I don't believe the cf cli allows you to make multiple changes with one command, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#managing-roles, although you could script it if you wanted. I do think the v3 CAPI might allow this, although I haven't done it myself. The v3 API changes the way users are managed, see https://v3-apidocs.cloudfoundry.org/version/3.126.0/index.html#roles and https://v3-apidocs.cloudfoundry.org/version/3.126.0/index.html#users-and-roles-in-v3 which explains how it's changed from v2 -> v3. – Daniel Mikusa Sep 21 '22 at 13:57

1 Answers1

0

You can do this using the following command but it doesn't allow multiple roles in single command. However you can wrap these into a small script and can run it with different roles for desired user:

org level roles

cf unset-org-role USERNAME ORGANIZATION-NAME ROLE

where ROLE: OrgManager, BillingManager and OrgAuditor

space level roles:

cf unset-space-role USERNAME ORGANIZATION-NAME SPACE-NAME ROLE

where ROLE: SpaceManager, SpaceDeveloper and SpaceAuditor

arjain13
  • 556
  • 3
  • 9