cloudfoundry / cloudfoundry/cloud_controller_ng

Make space roles assignable to users which have ANY org role

Open
#3,377 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement unscheduled
Dominant language
Ruby
Stars
207
Forks
373
Avg merge
2d 12h
Merged PRs (30d)
56

Description

Issue

Assigning space roles to users is only possible as long as the user has the organization_user role. Even when the user has other org roles like organization_manager, space roles cannot be assigned. Together with the inconsistent handling of this role in the cf cli this gets confusing to users.

Context

The V2 API assigned the organization_user automatically when assigning any org or space role to a user. V3 does not do so anymore (which is good).

CF CLI inconsistency:
The CF CLI does create the org user role whenever set-space-role is executed. When removing the space roles from the user, the org user role remains and cannot easily be removed by the unset-org-role, but has to be deleted via a cf curl -X DELETE /v3/roles.... In this regards the cf cli is inconsistent. I opened an issue regarding this in the CF CLI repo (https://github.com/cloudfoundry/cli/issues/2496)

Issue with API and suggested improvement:
From an API point of view it would be favourable to be able to assign space roles to a user who already has any org role and not be limited to the org user role. So for example if a user already has the org manager role, it should be possible to give that user space roles.
On deletion of the org user role, currently the CC also checks for space roles. If space roles are assigned to the user, the org user role cannot be removed. In this case it would also be better to check for existing space roles only when the last org role is requested to be removed. So e.g. a user has the org user and org manager role. If the deletion of the org user or org manager role is requested it should succeed, because one org role is still remaining, which gives access to the org and therefore access to the spaces. If, in a second request, the last org role is requested to be deleted it should fail if the user still has space roles in that org assigned.

Possible blockers:
As the V2 API is still in use and hasn't been removed completely, it needs to be checked whether this change could be implemented in a backwards compatible way.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the V3 role-assignment and role-removal paths, then compare them with the still-supported V2 behavior and the related CF CLI issue. Done means users with any organization role can receive space roles, org-role removal checks space roles only when removing the last org role, and the change remains backward compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, authorization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.