mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
6b3f5b984c
* refactor: switch from opencensus to opentelemetry * tempo works as designed nooooot * fix: log traceids * with grafana agent * fix: http tracing * fix: cleanup files * chore: remove todo * fix: bad test * fix: ignore methods in grpc interceptors * fix: remove test log * clean up * typo * fix(config): configure tracing endpoint * fix(span): add error id to span * feat: metrics package * feat: metrics package * fix: counter * fix: metric * try metrics * fix: coutner metrics * fix: active sessin counter * fix: active sessin counter * fix: change current Sequence table * fix: change current Sequence table * fix: current sequences * fix: spooler div metrics * fix: console view * fix: merge master * fix: Last spool run on search result instead of eventtimestamp * fix: go mod * Update console/src/assets/i18n/de.json Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: pr review * fix: map * update oidc pkg * fix: handlers * fix: value observer * fix: remove fmt * fix: handlers * fix: tests * fix: handler minimum cycle duration 1s * fix(spooler): handler channel buffer * fix interceptors Co-authored-by: adlerhurst <silvan.reusser@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
87 lines
3.3 KiB
Go
87 lines
3.3 KiB
Go
package view
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/errors"
|
|
usr_model "github.com/caos/zitadel/internal/user/model"
|
|
"github.com/caos/zitadel/internal/user/repository/view"
|
|
"github.com/caos/zitadel/internal/user/repository/view/model"
|
|
global_view "github.com/caos/zitadel/internal/view/repository"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
externalIDPTable = "adminapi.user_external_idps"
|
|
)
|
|
|
|
func (v *View) ExternalIDPByExternalUserIDAndIDPConfigID(externalUserID, idpConfigID string) (*model.ExternalIDPView, error) {
|
|
return view.ExternalIDPByExternalUserIDAndIDPConfigID(v.Db, externalIDPTable, externalUserID, idpConfigID)
|
|
}
|
|
|
|
func (v *View) ExternalIDPByExternalUserIDAndIDPConfigIDAndResourceOwner(externalUserID, idpConfigID, resourceOwner string) (*model.ExternalIDPView, error) {
|
|
return view.ExternalIDPByExternalUserIDAndIDPConfigIDAndResourceOwner(v.Db, externalIDPTable, externalUserID, idpConfigID, resourceOwner)
|
|
}
|
|
|
|
func (v *View) ExternalIDPsByIDPConfigID(idpConfigID string) ([]*model.ExternalIDPView, error) {
|
|
return view.ExternalIDPsByIDPConfigID(v.Db, externalIDPTable, idpConfigID)
|
|
}
|
|
|
|
func (v *View) ExternalIDPsByUserID(userID string) ([]*model.ExternalIDPView, error) {
|
|
return view.ExternalIDPsByUserID(v.Db, externalIDPTable, userID)
|
|
}
|
|
|
|
func (v *View) SearchExternalIDPs(request *usr_model.ExternalIDPSearchRequest) ([]*model.ExternalIDPView, uint64, error) {
|
|
return view.SearchExternalIDPs(v.Db, externalIDPTable, request)
|
|
}
|
|
|
|
func (v *View) PutExternalIDP(externalIDP *model.ExternalIDPView, sequence uint64, eventTimestamp time.Time) error {
|
|
err := view.PutExternalIDP(v.Db, externalIDPTable, externalIDP)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return v.ProcessedExternalIDPSequence(sequence, eventTimestamp)
|
|
}
|
|
|
|
func (v *View) PutExternalIDPs(sequence uint64, eventTimestamp time.Time, externalIDPs ...*model.ExternalIDPView) error {
|
|
err := view.PutExternalIDPs(v.Db, externalIDPTable, externalIDPs...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return v.ProcessedExternalIDPSequence(sequence, eventTimestamp)
|
|
}
|
|
|
|
func (v *View) DeleteExternalIDP(externalUserID, idpConfigID string, eventSequence uint64, eventTimestamp time.Time) error {
|
|
err := view.DeleteExternalIDP(v.Db, externalIDPTable, externalUserID, idpConfigID)
|
|
if err != nil && !errors.IsNotFound(err) {
|
|
return err
|
|
}
|
|
return v.ProcessedExternalIDPSequence(eventSequence, eventTimestamp)
|
|
}
|
|
|
|
func (v *View) DeleteExternalIDPsByUserID(userID string, eventSequence uint64, eventTimestamp time.Time) error {
|
|
err := view.DeleteExternalIDPsByUserID(v.Db, externalIDPTable, userID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return v.ProcessedExternalIDPSequence(eventSequence, eventTimestamp)
|
|
}
|
|
|
|
func (v *View) GetLatestExternalIDPSequence() (*global_view.CurrentSequence, error) {
|
|
return v.latestSequence(externalIDPTable)
|
|
}
|
|
|
|
func (v *View) ProcessedExternalIDPSequence(eventSequence uint64, eventTimestamp time.Time) error {
|
|
return v.saveCurrentSequence(externalIDPTable, eventSequence, eventTimestamp)
|
|
}
|
|
|
|
func (v *View) UpdateExternalIDPSpoolerRunTimestamp() error {
|
|
return v.updateSpoolerRunSequence(externalIDPTable)
|
|
}
|
|
|
|
func (v *View) GetLatestExternalIDPFailedEvent(sequence uint64) (*global_view.FailedEvent, error) {
|
|
return v.latestFailedEvent(externalIDPTable, sequence)
|
|
}
|
|
|
|
func (v *View) ProcessedExternalIDPFailedEvent(failedEvent *global_view.FailedEvent) error {
|
|
return v.saveFailedEvent(failedEvent)
|
|
}
|