mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
feat: actions (#2377)
* feat(actions): begin api * feat(actions): begin api * api and projections * fix: handle multiple statements for a single event in projections * export func type * fix test * update to new reduce interface * flows in login * feat: jwt idp * feat: command side * feat: add tests * actions and flows * fill idp views with jwt idps and return apis * add jwtEndpoint to jwt idp * begin jwt request handling * add feature * merge * merge * handle jwt idp * cleanup * bug fixes * autoregister * get token from specific header name * fix: proto * fixes * i18n * begin tests * fix and log http proxy * remove docker cache * fixes * usergrants in actions api * tests adn cleanup * cleanup * fix add user grant * set login context * i18n Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
This commit is contained in:
39
internal/domain/action.go
Normal file
39
internal/domain/action.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
type Action struct {
|
||||
models.ObjectRoot
|
||||
|
||||
Name string
|
||||
Script string
|
||||
Timeout time.Duration
|
||||
AllowedToFail bool
|
||||
State ActionState
|
||||
}
|
||||
|
||||
func (a *Action) IsValid() bool {
|
||||
return a.Name != ""
|
||||
}
|
||||
|
||||
type ActionState int32
|
||||
|
||||
const (
|
||||
ActionStateUnspecified ActionState = iota
|
||||
ActionStateActive
|
||||
ActionStateInactive
|
||||
ActionStateRemoved
|
||||
actionStateCount
|
||||
)
|
||||
|
||||
func (s ActionState) Valid() bool {
|
||||
return s >= 0 && s < actionStateCount
|
||||
}
|
||||
|
||||
func (s ActionState) Exists() bool {
|
||||
return s != ActionStateUnspecified && s != ActionStateRemoved
|
||||
}
|
@@ -68,6 +68,7 @@ type ExternalUser struct {
|
||||
PreferredLanguage language.Tag
|
||||
Phone string
|
||||
IsPhoneVerified bool
|
||||
Metadatas []*Metadata
|
||||
}
|
||||
|
||||
type Prompt int32
|
||||
|
@@ -26,6 +26,7 @@ const (
|
||||
FeatureCustomTextMessage = FeatureCustomText + ".message"
|
||||
FeatureCustomTextLogin = FeatureCustomText + ".login"
|
||||
FeatureMetadataUser = FeatureMetadata + ".user"
|
||||
FeatureActions = "actions"
|
||||
)
|
||||
|
||||
type Features struct {
|
||||
@@ -53,6 +54,7 @@ type Features struct {
|
||||
PrivacyPolicy bool
|
||||
MetadataUser bool
|
||||
LockoutPolicy bool
|
||||
Actions bool
|
||||
}
|
||||
|
||||
type FeaturesState int32
|
||||
|
52
internal/domain/flow.go
Normal file
52
internal/domain/flow.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package domain
|
||||
|
||||
type FlowState int32
|
||||
|
||||
const (
|
||||
FlowStateActive FlowState = iota
|
||||
FlowStateInactive
|
||||
flowStateCount
|
||||
)
|
||||
|
||||
func (s FlowState) Valid() bool {
|
||||
return s >= 0 && s < flowStateCount
|
||||
}
|
||||
|
||||
type FlowType int32
|
||||
|
||||
const (
|
||||
FlowTypeUnspecified FlowType = iota
|
||||
FlowTypeExternalAuthentication
|
||||
flowTypeCount
|
||||
)
|
||||
|
||||
func (s FlowType) Valid() bool {
|
||||
return s > 0 && s < flowTypeCount
|
||||
}
|
||||
|
||||
func (s FlowType) HasTrigger(triggerType TriggerType) bool {
|
||||
switch triggerType {
|
||||
case TriggerTypePostAuthentication:
|
||||
return s == FlowTypeExternalAuthentication
|
||||
case TriggerTypePreCreation:
|
||||
return s == FlowTypeExternalAuthentication
|
||||
case TriggerTypePostCreation:
|
||||
return s == FlowTypeExternalAuthentication
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
type TriggerType int32
|
||||
|
||||
const (
|
||||
TriggerTypeUnspecified TriggerType = iota
|
||||
TriggerTypePostAuthentication
|
||||
TriggerTypePreCreation
|
||||
TriggerTypePostCreation
|
||||
triggerTypeCount
|
||||
)
|
||||
|
||||
func (s TriggerType) Valid() bool {
|
||||
return s >= 0 && s < triggerTypeCount
|
||||
}
|
Reference in New Issue
Block a user