mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
3e1204524e
* fix: multiple setup steps * fix: test set up started * fix: possible nil pointers in setup * fix: validate executed step
45 lines
841 B
Go
45 lines
841 B
Go
package model
|
|
|
|
import (
|
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
|
)
|
|
|
|
type Step int
|
|
|
|
const (
|
|
Step1 Step = iota + 1
|
|
//TODO: label policy
|
|
// Step2
|
|
//StepCount marks the the length of possible steps (StepCount-1 == last possible step)
|
|
StepCount
|
|
)
|
|
|
|
type IAM struct {
|
|
es_models.ObjectRoot
|
|
GlobalOrgID string
|
|
IAMProjectID string
|
|
SetUpDone Step
|
|
SetUpStarted Step
|
|
Members []*IAMMember
|
|
IDPs []*IDPConfig
|
|
DefaultLoginPolicy *LoginPolicy
|
|
}
|
|
|
|
func (iam *IAM) GetMember(userID string) (int, *IAMMember) {
|
|
for i, m := range iam.Members {
|
|
if m.UserID == userID {
|
|
return i, m
|
|
}
|
|
}
|
|
return -1, nil
|
|
}
|
|
|
|
func (iam *IAM) GetIDP(idpID string) (int, *IDPConfig) {
|
|
for i, idp := range iam.IDPs {
|
|
if idp.IDPConfigID == idpID {
|
|
return i, idp
|
|
}
|
|
}
|
|
return -1, nil
|
|
}
|