fix: user grant query with user organization instead of organization … (#10732)

…of project grant

# Which Problems Are Solved

On Management API the fields for `GrantedOrgId`, `GrantedOrgName` and
`GrantedOrgDomain` were only filled if it was a usergrant for a granted
project.

# How the Problems Are Solved

Correctly query the Organization of the User again to the Organization
the Project is granted to.
Then fill in the information about the Organization of the User in the
fields `GrantedOrgId`, `GrantedOrgName` and `GrantedOrgDomain`.

# Additional Changes

Additionally query the information about the Organization the Project is
granted to, to have it available for the Authorization v2beta API.

# Additional Context

Closes #10723

---------

Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
(cherry picked from commit edb227f066)
This commit is contained in:
Stefan Benz
2025-09-16 12:04:53 +02:00
committed by Livio Spring
parent a3c0d53c79
commit 389f908041
3 changed files with 436 additions and 341 deletions

View File

@@ -39,9 +39,9 @@ func UserGrantToPb(assetPrefix string, grant *query.UserGrant) *user_pb.UserGran
AvatarUrl: domain.AvatarURL(assetPrefix, grant.UserResourceOwner, grant.AvatarURL),
PreferredLoginName: grant.PreferredLoginName,
UserType: TypeToPb(grant.UserType),
GrantedOrgId: grant.GrantedOrgID,
GrantedOrgName: grant.GrantedOrgName,
GrantedOrgDomain: grant.GrantedOrgDomain,
GrantedOrgId: grant.UserResourceOwner,
GrantedOrgName: grant.UserResourceOwnerName,
GrantedOrgDomain: grant.UserResourceOwnerDomain,
Details: object.ToViewDetailsPb(
grant.Sequence,
grant.CreationDate,