2021-01-12 11:59:51 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
2021-01-12 11:59:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func projectWriteModelToProject(writeModel *ProjectWriteModel) *domain.Project {
|
|
|
|
return &domain.Project{
|
2021-08-24 06:34:10 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(writeModel.WriteModel),
|
|
|
|
Name: writeModel.Name,
|
|
|
|
ProjectRoleAssertion: writeModel.ProjectRoleAssertion,
|
|
|
|
ProjectRoleCheck: writeModel.ProjectRoleCheck,
|
|
|
|
HasProjectCheck: writeModel.HasProjectCheck,
|
|
|
|
PrivateLabelingSetting: writeModel.PrivateLabelingSetting,
|
2021-01-12 11:59:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-28 05:35:26 +00:00
|
|
|
func projectGrantWriteModelToProjectGrant(writeModel *ProjectGrantWriteModel) *domain.ProjectGrant {
|
|
|
|
return &domain.ProjectGrant{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(writeModel.WriteModel),
|
|
|
|
GrantID: writeModel.GrantID,
|
|
|
|
GrantedOrgID: writeModel.GrantedOrgID,
|
|
|
|
RoleKeys: writeModel.RoleKeys,
|
|
|
|
State: writeModel.State,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func applicationWriteModelToApplication(writeModel *ApplicationWriteModel) domain.Application {
|
|
|
|
return &domain.ChangeApp{
|
|
|
|
AppID: writeModel.AppID,
|
|
|
|
AppName: writeModel.Name,
|
|
|
|
State: writeModel.State,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func oidcWriteModelToOIDCConfig(writeModel *OIDCApplicationWriteModel) *domain.OIDCApp {
|
|
|
|
return &domain.OIDCApp{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(writeModel.WriteModel),
|
2021-02-22 11:27:47 +00:00
|
|
|
AppID: writeModel.AppID,
|
2021-01-28 05:35:26 +00:00
|
|
|
AppName: writeModel.AppName,
|
|
|
|
State: writeModel.State,
|
|
|
|
ClientID: writeModel.ClientID,
|
|
|
|
RedirectUris: writeModel.RedirectUris,
|
|
|
|
ResponseTypes: writeModel.ResponseTypes,
|
|
|
|
GrantTypes: writeModel.GrantTypes,
|
|
|
|
ApplicationType: writeModel.ApplicationType,
|
|
|
|
AuthMethodType: writeModel.AuthMethodType,
|
|
|
|
PostLogoutRedirectUris: writeModel.PostLogoutRedirectUris,
|
|
|
|
OIDCVersion: writeModel.OIDCVersion,
|
|
|
|
DevMode: writeModel.DevMode,
|
|
|
|
AccessTokenType: writeModel.AccessTokenType,
|
|
|
|
AccessTokenRoleAssertion: writeModel.AccessTokenRoleAssertion,
|
|
|
|
IDTokenRoleAssertion: writeModel.IDTokenRoleAssertion,
|
|
|
|
IDTokenUserinfoAssertion: writeModel.IDTokenUserinfoAssertion,
|
|
|
|
ClockSkew: writeModel.ClockSkew,
|
2021-05-19 07:17:38 +00:00
|
|
|
AdditionalOrigins: writeModel.AdditionalOrigins,
|
2021-01-28 05:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-22 11:27:47 +00:00
|
|
|
func apiWriteModelToAPIConfig(writeModel *APIApplicationWriteModel) *domain.APIApp {
|
|
|
|
return &domain.APIApp{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(writeModel.WriteModel),
|
|
|
|
AppID: writeModel.AppID,
|
|
|
|
AppName: writeModel.AppName,
|
|
|
|
State: writeModel.State,
|
|
|
|
ClientID: writeModel.ClientID,
|
|
|
|
AuthMethodType: writeModel.AuthMethodType,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-28 05:35:26 +00:00
|
|
|
func roleWriteModelToRole(writeModel *ProjectRoleWriteModel) *domain.ProjectRole {
|
|
|
|
return &domain.ProjectRole{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(writeModel.WriteModel),
|
|
|
|
Key: writeModel.Key,
|
|
|
|
DisplayName: writeModel.DisplayName,
|
|
|
|
Group: writeModel.Group,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func memberWriteModelToProjectGrantMember(writeModel *ProjectGrantMemberWriteModel) *domain.ProjectGrantMember {
|
|
|
|
return &domain.ProjectGrantMember{
|
2021-01-12 11:59:51 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(writeModel.WriteModel),
|
2021-01-28 05:35:26 +00:00
|
|
|
Roles: writeModel.Roles,
|
|
|
|
GrantID: writeModel.GrantID,
|
|
|
|
UserID: writeModel.UserID,
|
2021-01-12 11:59:51 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-22 11:27:47 +00:00
|
|
|
|
|
|
|
func applicationKeyWriteModelToKey(wm *ApplicationKeyWriteModel, privateKey []byte) *domain.ApplicationKey {
|
|
|
|
return &domain.ApplicationKey{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
ApplicationID: wm.AppID,
|
|
|
|
ClientID: wm.ClientID,
|
|
|
|
KeyID: wm.KeyID,
|
|
|
|
Type: wm.KeyType,
|
|
|
|
ExpirationDate: wm.ExpirationDate,
|
|
|
|
PrivateKey: privateKey,
|
|
|
|
}
|
|
|
|
}
|