mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:47:33 +00:00
@@ -248,7 +248,6 @@ func prepareInstancesQuery() (sq.SelectBuilder, func(*sql.Rows) (*Instances, err
|
||||
for rows.Next() {
|
||||
instance := new(Instance)
|
||||
lang := ""
|
||||
//TODO: Get Host
|
||||
err := rows.Scan(
|
||||
&instance.ID,
|
||||
&instance.CreationDate,
|
||||
|
@@ -59,10 +59,6 @@ var (
|
||||
name: projection.ProjectColumnInstanceID,
|
||||
table: projectsTable,
|
||||
}
|
||||
ProjectColumnCreator = Column{
|
||||
name: projection.ProjectColumnCreator,
|
||||
table: projectsTable,
|
||||
}
|
||||
ProjectColumnSequence = Column{
|
||||
name: projection.ProjectColumnSequence,
|
||||
table: projectsTable,
|
||||
|
@@ -65,10 +65,6 @@ var (
|
||||
name: projection.ProjectGrantColumnRoleKeys,
|
||||
table: projectGrantsTable,
|
||||
}
|
||||
ProjectGrantColumnCreator = Column{
|
||||
name: projection.ProjectGrantColumnCreator,
|
||||
table: projectGrantsTable,
|
||||
}
|
||||
ProjectGrantColumnGrantedOrgName = Column{
|
||||
name: projection.OrgColumnName,
|
||||
table: orgsTable.setAlias(ProjectGrantGrantedOrgTableAlias),
|
||||
|
@@ -53,10 +53,6 @@ var (
|
||||
name: projection.ProjectRoleColumnGroupName,
|
||||
table: projectRolesTable,
|
||||
}
|
||||
ProjectRoleColumnCreator = Column{
|
||||
name: projection.ProjectRoleColumnCreator,
|
||||
table: projectRolesTable,
|
||||
}
|
||||
)
|
||||
|
||||
type ProjectRoles struct {
|
||||
|
@@ -94,17 +94,17 @@ func NewAppProjection(ctx context.Context, config crdb.StatementHandlerConfig) *
|
||||
crdb.NewColumn(AppOIDCConfigColumnClientID, crdb.ColumnTypeText),
|
||||
crdb.NewColumn(AppOIDCConfigColumnClientSecret, crdb.ColumnTypeJSONB, crdb.Nullable()),
|
||||
crdb.NewColumn(AppOIDCConfigColumnRedirectUris, crdb.ColumnTypeTextArray, crdb.Nullable()),
|
||||
crdb.NewColumn(AppOIDCConfigColumnResponseTypes, crdb.ColumnTypeEnumArray, crdb.Nullable()), //TODO: null?
|
||||
crdb.NewColumn(AppOIDCConfigColumnGrantTypes, crdb.ColumnTypeEnumArray, crdb.Nullable()), //TODO: null?
|
||||
crdb.NewColumn(AppOIDCConfigColumnResponseTypes, crdb.ColumnTypeEnumArray, crdb.Nullable()),
|
||||
crdb.NewColumn(AppOIDCConfigColumnGrantTypes, crdb.ColumnTypeEnumArray, crdb.Nullable()),
|
||||
crdb.NewColumn(AppOIDCConfigColumnApplicationType, crdb.ColumnTypeEnum),
|
||||
crdb.NewColumn(AppOIDCConfigColumnAuthMethodType, crdb.ColumnTypeEnum),
|
||||
crdb.NewColumn(AppOIDCConfigColumnPostLogoutRedirectUris, crdb.ColumnTypeTextArray, crdb.Nullable()),
|
||||
crdb.NewColumn(AppOIDCConfigColumnDevMode, crdb.ColumnTypeBool),
|
||||
crdb.NewColumn(AppOIDCConfigColumnAccessTokenType, crdb.ColumnTypeEnum),
|
||||
crdb.NewColumn(AppOIDCConfigColumnAccessTokenRoleAssertion, crdb.ColumnTypeBool, crdb.Nullable()), //TODO: null?
|
||||
crdb.NewColumn(AppOIDCConfigColumnIDTokenRoleAssertion, crdb.ColumnTypeBool, crdb.Nullable()), //TODO: null?
|
||||
crdb.NewColumn(AppOIDCConfigColumnIDTokenUserinfoAssertion, crdb.ColumnTypeBool, crdb.Nullable()), //TODO: null?
|
||||
crdb.NewColumn(AppOIDCConfigColumnClockSkew, crdb.ColumnTypeInt64, crdb.Nullable()), //TODO: null?
|
||||
crdb.NewColumn(AppOIDCConfigColumnAccessTokenRoleAssertion, crdb.ColumnTypeBool, crdb.Default(false)),
|
||||
crdb.NewColumn(AppOIDCConfigColumnIDTokenRoleAssertion, crdb.ColumnTypeBool, crdb.Default(false)),
|
||||
crdb.NewColumn(AppOIDCConfigColumnIDTokenUserinfoAssertion, crdb.ColumnTypeBool, crdb.Default(false)),
|
||||
crdb.NewColumn(AppOIDCConfigColumnClockSkew, crdb.ColumnTypeInt64, crdb.Default(0)),
|
||||
crdb.NewColumn(AppOIDCConfigColumnAdditionalOrigins, crdb.ColumnTypeTextArray, crdb.Nullable()),
|
||||
},
|
||||
crdb.NewPrimaryKey(AppOIDCConfigColumnAppID),
|
||||
|
@@ -26,7 +26,6 @@ const (
|
||||
ProjectColumnProjectRoleCheck = "project_role_check"
|
||||
ProjectColumnHasProjectCheck = "has_project_check"
|
||||
ProjectColumnPrivateLabelingSetting = "private_labeling_setting"
|
||||
ProjectColumnCreator = "creator_id" //TODO: necessary?
|
||||
)
|
||||
|
||||
type ProjectProjection struct {
|
||||
@@ -51,7 +50,6 @@ func NewProjectProjection(ctx context.Context, config crdb.StatementHandlerConfi
|
||||
crdb.NewColumn(ProjectColumnProjectRoleCheck, crdb.ColumnTypeBool),
|
||||
crdb.NewColumn(ProjectColumnHasProjectCheck, crdb.ColumnTypeBool),
|
||||
crdb.NewColumn(ProjectColumnPrivateLabelingSetting, crdb.ColumnTypeEnum),
|
||||
crdb.NewColumn(ProjectColumnCreator, crdb.ColumnTypeText),
|
||||
},
|
||||
crdb.NewPrimaryKey(ProjectColumnInstanceID, ProjectColumnID),
|
||||
crdb.WithIndex(crdb.NewIndex("ro_idx", []string{ProjectColumnResourceOwner})),
|
||||
@@ -111,7 +109,6 @@ func (p *ProjectProjection) reduceProjectAdded(event eventstore.Event) (*handler
|
||||
handler.NewCol(ProjectColumnHasProjectCheck, e.HasProjectCheck),
|
||||
handler.NewCol(ProjectColumnPrivateLabelingSetting, e.PrivateLabelingSetting),
|
||||
handler.NewCol(ProjectColumnState, domain.ProjectStateActive),
|
||||
handler.NewCol(ProjectColumnCreator, e.EditorUser()),
|
||||
},
|
||||
), nil
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ const (
|
||||
ProjectGrantColumnProjectID = "project_id"
|
||||
ProjectGrantColumnGrantedOrgID = "granted_org_id"
|
||||
ProjectGrantColumnRoleKeys = "granted_role_keys"
|
||||
ProjectGrantColumnCreator = "creator_id" //TODO: necessary?
|
||||
)
|
||||
|
||||
type ProjectGrantProjection struct {
|
||||
@@ -49,7 +48,6 @@ func NewProjectGrantProjection(ctx context.Context, config crdb.StatementHandler
|
||||
crdb.NewColumn(ProjectGrantColumnProjectID, crdb.ColumnTypeText),
|
||||
crdb.NewColumn(ProjectGrantColumnGrantedOrgID, crdb.ColumnTypeText),
|
||||
crdb.NewColumn(ProjectGrantColumnRoleKeys, crdb.ColumnTypeTextArray),
|
||||
crdb.NewColumn(ProjectGrantColumnCreator, crdb.ColumnTypeText),
|
||||
},
|
||||
crdb.NewPrimaryKey(ProjectGrantColumnInstanceID, ProjectGrantColumnGrantID),
|
||||
crdb.WithIndex(crdb.NewIndex("ro_idx", []string{ProjectGrantColumnResourceOwner})),
|
||||
@@ -116,7 +114,6 @@ func (p *ProjectGrantProjection) reduceProjectGrantAdded(event eventstore.Event)
|
||||
handler.NewCol(ProjectGrantColumnSequence, e.Sequence()),
|
||||
handler.NewCol(ProjectGrantColumnGrantedOrgID, e.GrantedOrgID),
|
||||
handler.NewCol(ProjectGrantColumnRoleKeys, pq.StringArray(e.RoleKeys)),
|
||||
handler.NewCol(ProjectGrantColumnCreator, e.EditorUser()),
|
||||
},
|
||||
), nil
|
||||
}
|
||||
|
@@ -220,7 +220,7 @@ func TestProjectGrantProjection_reduces(t *testing.T) {
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
expectedStmt: "INSERT INTO projections.project_grants (grant_id, project_id, creation_date, change_date, resource_owner, instance_id, state, sequence, granted_org_id, granted_role_keys, creator_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
|
||||
expectedStmt: "INSERT INTO projections.project_grants (grant_id, project_id, creation_date, change_date, resource_owner, instance_id, state, sequence, granted_org_id, granted_role_keys) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
|
||||
expectedArgs: []interface{}{
|
||||
"grant-id",
|
||||
"agg-id",
|
||||
@@ -232,7 +232,6 @@ func TestProjectGrantProjection_reduces(t *testing.T) {
|
||||
uint64(15),
|
||||
"granted-org-id",
|
||||
pq.StringArray{"admin", "user"},
|
||||
"editor-user",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@@ -22,7 +22,6 @@ const (
|
||||
ProjectRoleColumnInstanceID = "instance_id"
|
||||
ProjectRoleColumnDisplayName = "display_name"
|
||||
ProjectRoleColumnGroupName = "group_name"
|
||||
ProjectRoleColumnCreator = "creator_id" //TODO: necessary?
|
||||
)
|
||||
|
||||
type ProjectRoleProjection struct {
|
||||
@@ -44,7 +43,6 @@ func NewProjectRoleProjection(ctx context.Context, config crdb.StatementHandlerC
|
||||
crdb.NewColumn(ProjectRoleColumnInstanceID, crdb.ColumnTypeText),
|
||||
crdb.NewColumn(ProjectRoleColumnDisplayName, crdb.ColumnTypeText),
|
||||
crdb.NewColumn(ProjectRoleColumnGroupName, crdb.ColumnTypeText),
|
||||
crdb.NewColumn(ProjectRoleColumnCreator, crdb.ColumnTypeText),
|
||||
},
|
||||
crdb.NewPrimaryKey(ProjectRoleColumnInstanceID, ProjectRoleColumnProjectID, ProjectRoleColumnKey),
|
||||
),
|
||||
@@ -96,7 +94,6 @@ func (p *ProjectRoleProjection) reduceProjectRoleAdded(event eventstore.Event) (
|
||||
handler.NewCol(ProjectRoleColumnSequence, e.Sequence()),
|
||||
handler.NewCol(ProjectRoleColumnDisplayName, e.DisplayName),
|
||||
handler.NewCol(ProjectRoleColumnGroupName, e.Group),
|
||||
handler.NewCol(ProjectRoleColumnCreator, e.EditorUser()),
|
||||
},
|
||||
), nil
|
||||
}
|
||||
|
@@ -143,7 +143,7 @@ func TestProjectRoleProjection_reduces(t *testing.T) {
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
expectedStmt: "INSERT INTO projections.project_roles (role_key, project_id, creation_date, change_date, resource_owner, instance_id, sequence, display_name, group_name, creator_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
|
||||
expectedStmt: "INSERT INTO projections.project_roles (role_key, project_id, creation_date, change_date, resource_owner, instance_id, sequence, display_name, group_name) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||
expectedArgs: []interface{}{
|
||||
"key",
|
||||
"agg-id",
|
||||
@@ -154,7 +154,6 @@ func TestProjectRoleProjection_reduces(t *testing.T) {
|
||||
uint64(15),
|
||||
"Key",
|
||||
"Group",
|
||||
"editor-user",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@@ -178,7 +178,7 @@ func TestProjectProjection_reduces(t *testing.T) {
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
expectedStmt: "INSERT INTO projections.projects (id, creation_date, change_date, resource_owner, instance_id, sequence, name, project_role_assertion, project_role_check, has_project_check, private_labeling_setting, state, creator_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
|
||||
expectedStmt: "INSERT INTO projections.projects (id, creation_date, change_date, resource_owner, instance_id, sequence, name, project_role_assertion, project_role_check, has_project_check, private_labeling_setting, state) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||
expectedArgs: []interface{}{
|
||||
"agg-id",
|
||||
anyArg{},
|
||||
@@ -192,7 +192,6 @@ func TestProjectProjection_reduces(t *testing.T) {
|
||||
true,
|
||||
domain.PrivateLabelingSettingEnforceProjectResourceOwnerPolicy,
|
||||
domain.ProjectStateActive,
|
||||
"editor-user",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@@ -88,7 +88,6 @@ var (
|
||||
` projections.users.change_date,` +
|
||||
` projections.users.resource_owner,` +
|
||||
` projections.users.sequence,` +
|
||||
//` projections.users.state,` + //TODO:
|
||||
` projections.users_humans.user_id,` +
|
||||
` projections.users_humans.first_name,` +
|
||||
` projections.users_humans.last_name,` +
|
||||
@@ -105,7 +104,6 @@ var (
|
||||
"change_date",
|
||||
"resource_owner",
|
||||
"sequence",
|
||||
//"state", //TODO:
|
||||
"user_id",
|
||||
"first_name",
|
||||
"last_name",
|
||||
@@ -120,7 +118,6 @@ var (
|
||||
` projections.users.change_date,` +
|
||||
` projections.users.resource_owner,` +
|
||||
` projections.users.sequence,` +
|
||||
//` projections.users.state,` + //TODO:
|
||||
` projections.users_humans.user_id,` +
|
||||
` projections.users_humans.email,` +
|
||||
` projections.users_humans.is_email_verified` +
|
||||
@@ -132,7 +129,6 @@ var (
|
||||
"change_date",
|
||||
"resource_owner",
|
||||
"sequence",
|
||||
//"state", //TODO:
|
||||
"user_id",
|
||||
"email",
|
||||
"is_email_verified",
|
||||
@@ -142,7 +138,6 @@ var (
|
||||
` projections.users.change_date,` +
|
||||
` projections.users.resource_owner,` +
|
||||
` projections.users.sequence,` +
|
||||
//` projections.users.state,` + //TODO:
|
||||
` projections.users_humans.user_id,` +
|
||||
` projections.users_humans.phone,` +
|
||||
` projections.users_humans.is_phone_verified` +
|
||||
@@ -154,7 +149,6 @@ var (
|
||||
"change_date",
|
||||
"resource_owner",
|
||||
"sequence",
|
||||
//"state", //TODO:
|
||||
"user_id",
|
||||
"phone",
|
||||
"is_phone_verified",
|
||||
@@ -163,28 +157,15 @@ var (
|
||||
userUniqueQuery = `SELECT projections.users.id,` +
|
||||
` projections.users.state,` +
|
||||
` projections.users.username,` +
|
||||
//` login_names.login_names,` +
|
||||
//` preferred_login_name.login_name,` +
|
||||
` projections.users_humans.user_id,` +
|
||||
` projections.users_humans.email,` +
|
||||
` projections.users_humans.is_email_verified` +
|
||||
` FROM projections.users` +
|
||||
` LEFT JOIN projections.users_humans ON projections.users.id = projections.users_humans.user_id`
|
||||
//` LEFT JOIN` +
|
||||
//` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name) as login_names` +
|
||||
//` FROM projections.login_names as login_names` +
|
||||
//` GROUP BY login_names.user_id) as login_names` +
|
||||
//` on login_names.user_id = projections.users.id` +
|
||||
//` LEFT JOIN` +
|
||||
//` (SELECT preferred_login_name.user_id, preferred_login_name.login_name FROM projections.login_names as preferred_login_name WHERE preferred_login_name.is_primary = $1) as preferred_login_name` +
|
||||
//` on preferred_login_name.user_id = projections.users.id`
|
||||
userUniqueCols = []string{
|
||||
"id",
|
||||
"state",
|
||||
"username",
|
||||
//"login_names",
|
||||
//"login_name",
|
||||
//human
|
||||
"user_id",
|
||||
"email",
|
||||
"is_email_verified",
|
||||
|
Reference in New Issue
Block a user