mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
3cd3a238c2
* fix: all enums same style * fix: rename process to reduce * add some missing enum renaming Co-authored-by: Livio Amstutz <livio.a@gmail.com>
61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
|
"github.com/golang/protobuf/ptypes/timestamp"
|
|
)
|
|
|
|
type Application struct {
|
|
es_models.ObjectRoot
|
|
|
|
AppID string
|
|
State AppState
|
|
Name string
|
|
Type AppType
|
|
OIDCConfig *OIDCConfig
|
|
}
|
|
type ApplicationChanges struct {
|
|
Changes []*ApplicationChange
|
|
LastSequence uint64
|
|
}
|
|
|
|
type ApplicationChange struct {
|
|
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
|
|
EventType string `json:"eventType,omitempty"`
|
|
Sequence uint64 `json:"sequence,omitempty"`
|
|
Modifier string `json:"modifierUser,omitempty"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
}
|
|
|
|
type AppState int32
|
|
|
|
const (
|
|
AppStateActive AppState = iota
|
|
AppStateInactive
|
|
)
|
|
|
|
type AppType int32
|
|
|
|
const (
|
|
AppTypeUnspecified AppType = iota
|
|
AppTypeOIDC
|
|
AppTypeSAML
|
|
)
|
|
|
|
func NewApplication(projectID, appID string) *Application {
|
|
return &Application{ObjectRoot: es_models.ObjectRoot{AggregateID: projectID}, AppID: appID, State: AppStateActive}
|
|
}
|
|
|
|
func (a *Application) IsValid(includeConfig bool) bool {
|
|
if a.Name == "" || a.AggregateID == "" {
|
|
return false
|
|
}
|
|
if !includeConfig {
|
|
return true
|
|
}
|
|
if a.Type == AppTypeOIDC && !a.OIDCConfig.IsValid() {
|
|
return false
|
|
}
|
|
return true
|
|
}
|