mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-18 19:25:13 +00:00
fix: refactor setup (#1152)
* add setup steps * refactoring * omitempty * cleanup * fixes
This commit is contained in:
+47
-46
@@ -1,52 +1,53 @@
|
||||
package setup
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/logging"
|
||||
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
"github.com/caos/zitadel/internal/v2/command"
|
||||
)
|
||||
|
||||
type Step1 struct {
|
||||
//GlobalOrg string
|
||||
//IAMProject string
|
||||
//DefaultLoginPolicy LoginPolicy
|
||||
//Orgs []Org
|
||||
//Owners []string
|
||||
command.Step1
|
||||
|
||||
//setup *Setup
|
||||
//createdUsers map[string]*usr_model.User
|
||||
//createdOrgs map[string]*org_model.Org
|
||||
//createdProjects map[string]*proj_model.Project
|
||||
//pwComplexityPolicy *iam_model.PasswordComplexityPolicyView
|
||||
}
|
||||
|
||||
func (s *Step1) isNil() bool {
|
||||
return s == nil
|
||||
}
|
||||
|
||||
func (s *Step1) step() iam_model.Step {
|
||||
return iam_model.Step1
|
||||
}
|
||||
|
||||
//func (s *Step1) init(setup *Setup) {
|
||||
// s.setup = setup
|
||||
// s.createdUsers = make(map[string]*usr_model.User)
|
||||
// s.createdOrgs = make(map[string]*org_model.Org)
|
||||
// s.createdProjects = make(map[string]*proj_model.Project)
|
||||
// TODO: implement
|
||||
//import (
|
||||
// "context"
|
||||
//
|
||||
// "github.com/caos/logging"
|
||||
//
|
||||
// iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
// "github.com/caos/zitadel/internal/v2/command"
|
||||
//)
|
||||
//
|
||||
//type Step1 struct {
|
||||
// //GlobalOrg string
|
||||
// //IAMProject string
|
||||
// //DefaultLoginPolicy LoginPolicy
|
||||
// //Orgs []Org
|
||||
// //Owners []string
|
||||
// command.Step1
|
||||
//
|
||||
// //setup *Setup
|
||||
// //createdUsers map[string]*usr_model.User
|
||||
// //createdOrgs map[string]*org_model.Org
|
||||
// //createdProjects map[string]*proj_model.Project
|
||||
// //pwComplexityPolicy *iam_model.PasswordComplexityPolicyView
|
||||
//}
|
||||
//
|
||||
//func (s *Step1) isNil() bool {
|
||||
// return s == nil
|
||||
//}
|
||||
//
|
||||
//func (s *Step1) step() iam_model.Step {
|
||||
// return iam_model.Step1
|
||||
//}
|
||||
//
|
||||
////func (s *Step1) init(setup *Setup) {
|
||||
//// s.setup = setup
|
||||
//// s.createdUsers = make(map[string]*usr_model.User)
|
||||
//// s.createdOrgs = make(map[string]*org_model.Org)
|
||||
//// s.createdProjects = make(map[string]*proj_model.Project)
|
||||
////}
|
||||
//
|
||||
//func (s *Step1) execute(ctx context.Context, iamID string, commands command.CommandSide) error {
|
||||
// err := commands.SetupStep1(ctx, iamID, s.Step1)
|
||||
// if err != nil {
|
||||
// logging.Log("SETUP-de342").WithField("step", s.step()).WithError(err).Error("unable to finish setup")
|
||||
// return err
|
||||
// }
|
||||
// return nil
|
||||
//}
|
||||
|
||||
func (s *Step1) execute(ctx context.Context, iamID string, commands command.CommandSide) error {
|
||||
err := commands.SetupStep1(ctx, iamID, s.Step1)
|
||||
if err != nil {
|
||||
logging.Log("SETUP-de342").WithField("step", s.step()).WithError(err).Error("unable to finish setup")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
//func (step *Step1) loginPolicy(ctx context.Context, policy LoginPolicy) error {
|
||||
|
||||
Reference in New Issue
Block a user