fix: add organizationID query for user v2 ListUsers and clean up depeprecated attribute (#7593)

Add organizationID as query for ListUsers and clean up the deprecated Organisation attributes in other queries.

This PR removes the following fields from API requests (user service v2):

organisation from AddHumanUser (deprecated some time ago, organization still exists)
organization from GetUserByID
This commit is contained in:
Stefan Benz
2024-03-21 09:07:00 +01:00
committed by GitHub
parent 7e24a1adbc
commit 319ebe7898
8 changed files with 217 additions and 143 deletions

View File

@@ -44,30 +44,17 @@ func authorize(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
func orgIDAndDomainFromRequest(ctx context.Context, req interface{}) (id, domain string) {
orgID := grpc_util.GetHeader(ctx, http.ZitadelOrgID)
o, ok := req.(OrganizationFromRequest)
if !ok {
return orgID, ""
}
id = o.OrganizationFromRequest().ID
domain = o.OrganizationFromRequest().Domain
if id != "" || domain != "" {
return id, domain
}
// check if the deprecated organisation is used.
// to be removed before going GA (https://github.com/zitadel/zitadel/issues/6718)
id = o.OrganisationFromRequest().ID
domain = o.OrganisationFromRequest().Domain
if id != "" || domain != "" {
return id, domain
oz, ok := req.(OrganizationFromRequest)
if ok {
id = oz.OrganizationFromRequest().ID
domain = oz.OrganizationFromRequest().Domain
if id != "" || domain != "" {
return id, domain
}
}
return orgID, domain
}
// Deprecated: will be removed in favor of OrganizationFromRequest (https://github.com/zitadel/zitadel/issues/6718)
type OrganisationFromRequest interface {
OrganisationFromRequest() *Organization
}
type Organization struct {
ID string
Domain string
@@ -75,5 +62,4 @@ type Organization struct {
type OrganizationFromRequest interface {
OrganizationFromRequest() *Organization
OrganisationFromRequest
}