mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
fix: handle default org id (#3769)
This commit is contained in:
@@ -18,6 +18,7 @@ type Instance interface {
|
||||
RequestedDomain() string
|
||||
RequestedHost() string
|
||||
DefaultLanguage() language.Tag
|
||||
DefaultOrganisationID() string
|
||||
}
|
||||
|
||||
type InstanceVerifier interface {
|
||||
@@ -25,15 +26,16 @@ type InstanceVerifier interface {
|
||||
}
|
||||
|
||||
type instance struct {
|
||||
ID string
|
||||
Domain string
|
||||
id string
|
||||
domain string
|
||||
projectID string
|
||||
appID string
|
||||
clientID string
|
||||
orgID string
|
||||
}
|
||||
|
||||
func (i *instance) InstanceID() string {
|
||||
return i.ID
|
||||
return i.id
|
||||
}
|
||||
|
||||
func (i *instance) ProjectID() string {
|
||||
@@ -49,17 +51,21 @@ func (i *instance) ConsoleApplicationID() string {
|
||||
}
|
||||
|
||||
func (i *instance) RequestedDomain() string {
|
||||
return i.Domain
|
||||
return i.domain
|
||||
}
|
||||
|
||||
func (i *instance) RequestedHost() string {
|
||||
return i.Domain
|
||||
return i.domain
|
||||
}
|
||||
|
||||
func (i *instance) DefaultLanguage() language.Tag {
|
||||
return language.Und
|
||||
}
|
||||
|
||||
func (i *instance) DefaultOrganisationID() string {
|
||||
return i.orgID
|
||||
}
|
||||
|
||||
func GetInstance(ctx context.Context) Instance {
|
||||
instance, ok := ctx.Value(instanceKey).(Instance)
|
||||
if !ok {
|
||||
@@ -73,7 +79,7 @@ func WithInstance(ctx context.Context, instance Instance) context.Context {
|
||||
}
|
||||
|
||||
func WithInstanceID(ctx context.Context, id string) context.Context {
|
||||
return context.WithValue(ctx, instanceKey, &instance{ID: id})
|
||||
return context.WithValue(ctx, instanceKey, &instance{id: id})
|
||||
}
|
||||
|
||||
func WithRequestedDomain(ctx context.Context, domain string) context.Context {
|
||||
@@ -82,7 +88,7 @@ func WithRequestedDomain(ctx context.Context, domain string) context.Context {
|
||||
i = new(instance)
|
||||
}
|
||||
|
||||
i.Domain = domain
|
||||
i.domain = domain
|
||||
return context.WithValue(ctx, instanceKey, i)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user