Skip to content
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

Implement shadow user creation by org manager #4113

Merged
merged 15 commits into from
Jan 9, 2025

Conversation

svkrieger
Copy link
Contributor

@svkrieger svkrieger commented Nov 28, 2024

A short explanation of the proposed change:

Implementation of the shadow user creation by org managers according to the RFC https://github.com/cloudfoundry/community/blob/main/toc/rfc/rfc-0033-user-creation-by-org-managers.md

Links to any other associated PRs

Add configuration to CAPI release: cloudfoundry/capi-release#491

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@svkrieger svkrieger force-pushed the implement-shadow-user-creation-by-org-manager branch from 2c99e5d to 39a4b2a Compare December 3, 2024 09:57
lib/tasks/spec.rake Outdated Show resolved Hide resolved
jochenehret
jochenehret previously approved these changes Dec 3, 2024
@svkrieger svkrieger force-pushed the implement-shadow-user-creation-by-org-manager branch 2 times, most recently from 6a27ed1 to 626f8e6 Compare December 18, 2024 08:35
@svkrieger svkrieger force-pushed the implement-shadow-user-creation-by-org-manager branch from 626f8e6 to 2968960 Compare January 7, 2025 12:41
@svkrieger
Copy link
Contributor Author

svkrieger commented Jan 7, 2025

To make sure that we don't break the behaviour before introducing this new feature the following table shows relevant scenarios before the change and the same scenarios after the change when the feature is disabled and no client is configured.

Test catalog before change

/v3/users endpoint

Privileges User exists in UAA? Origin Request Method Request path data Response Code Response Body
admin NO != uaa POST /v3/users '{"username":"[email protected]","origin":"keycloak.local"}' 422 - Unprocessable Entity "Unknown field(s): 'username', 'origin', Guid must be a string, Guid must be between 1 and 200 characters"
others NO != uaa POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"
admin NO uaa POST /v3/users '{"username":"[email protected]","origin":"uaa"}' 422 - Unprocessable Entity "Unknown field(s): 'username', 'origin', Guid must be a string, Guid must be between 1 and 200 characters"
others NO uaa POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"
admin NO - POST /v3/users '{"guid":"some-guid"}' 201 Created (this only creates a DB entry in CCDB) user object (origin null, username null)
others NO - POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"
admin YES - POST /v3/users '{"guid":"some-guid"}' 201 Created user object (origin and username is set and comes from UAA)
others YES - POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"

/v3/roles endpoint

Privileges User exists in UAA? Origin Request Method Request path data Response Code Response Body
admin NO uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'uaa'."
org manager NO uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'uaa'."
admin NO != uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'keycloak.local'."
org manager NO != uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'keycloak.local'."
others NO uaa POST /v3/roles org guid + username + origin + org auditor 403 Forbidden "You are not authorized to perform the requested action"
admin YES uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object
org manager YES uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object
admin YES != uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object
org manager YES != uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object

Test catalog after change when feature is disabled and no client config present

/v3/users endpoint

Privileges User exists in UAA? Origin Request Method Request path data Response Code Response Body
admin NO != uaa POST /v3/users '{"username":"[email protected]","origin":"keycloak.local"}' 500 - Internal Server Error "An unknown error occurred."
others NO != uaa POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"
admin NO uaa POST /v3/users '{"username":"[email protected]","origin":"uaa"}' 422 - Unprocessable Entity "Origin cannot be 'uaa' when creating a user by username"
others NO uaa POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"
admin NO - POST /v3/users '{"guid":"some-guid"}' 201 Created (this only creates a DB entry in CCDB) user object (origin null, username null)
others NO - POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"
admin YES - POST /v3/users '{"guid":"some-guid"}' 201 Created user object (origin and username is set and comes from UAA)
others YES - POST /v3/users same 403 Forbidden "You are not authorized to perform the requested action"

/v3/roles endpoint

Privileges User exists in UAA? Origin Request Method Request path data Response Code Response Body
admin NO uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'uaa'."
org manager NO uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'uaa'."
admin NO != uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'keycloak.local'."
org manager NO != uaa POST /v3/roles org guid + username + origin + org auditor 422 Unprocessable Entity "No user exists with the username '[email protected]' and origin 'keycloak.local'."
others NO uaa POST /v3/roles org guid + username + origin + org auditor 403 Forbidden "You are not authorized to perform the requested action"
admin YES uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object
org manager YES uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object
admin YES != uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object
org manager YES != uaa POST /v3/roles org guid + username + origin + org auditor 201 Created role object

@svkrieger svkrieger mentioned this pull request Jan 7, 2025
5 tasks
@svkrieger svkrieger requested a review from jochenehret January 8, 2025 09:12
@svkrieger svkrieger merged commit 4e53164 into main Jan 9, 2025
8 checks passed
@svkrieger svkrieger deleted the implement-shadow-user-creation-by-org-manager branch January 9, 2025 10:06
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request Jan 9, 2025
Changes in cloud_controller_ng:

- Implement shadow user creation by org manager
    PR: cloudfoundry/cloud_controller_ng#4113
    Author: Sven Krieger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants