mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
03a38fbf1c
* feat: add get custom message text to admin api * feat: read custom message texts from files * feat: get languages in apis * feat: get languages in apis * feat: get languages in apis * feat: pr feedback * feat: docs * feat: merge main
39 lines
877 B
Go
39 lines
877 B
Go
package eventstore
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/caos/logging"
|
|
"golang.org/x/text/language"
|
|
|
|
"github.com/caos/zitadel/internal/i18n"
|
|
"github.com/caos/zitadel/internal/query"
|
|
|
|
"github.com/caos/zitadel/internal/iam/model"
|
|
)
|
|
|
|
type IAMRepository struct {
|
|
IAMID string
|
|
LoginDir http.FileSystem
|
|
|
|
IAMV2QuerySide *query.Queries
|
|
supportedLangs []language.Tag
|
|
}
|
|
|
|
func (repo *IAMRepository) Languages(ctx context.Context) ([]language.Tag, error) {
|
|
if len(repo.supportedLangs) == 0 {
|
|
langs, err := i18n.SupportedLanguages(repo.LoginDir)
|
|
if err != nil {
|
|
logging.Log("ADMIN-tiMWs").WithError(err).Debug("unable to parse language")
|
|
return nil, err
|
|
}
|
|
repo.supportedLangs = langs
|
|
}
|
|
return repo.supportedLangs, nil
|
|
}
|
|
|
|
func (repo *IAMRepository) GetIAM(ctx context.Context) (*model.IAM, error) {
|
|
return repo.IAMV2QuerySide.IAMByID(ctx, repo.IAMID)
|
|
}
|