mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 04:07:31 +00:00
feat: handle instanceID in projections (#3442)
* feat: handle instanceID in projections * rename functions * fix key lock * fix import
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/query/projection"
|
||||
)
|
||||
@@ -72,6 +73,7 @@ func (q *Queries) latestSequence(ctx context.Context, projections ...table) (*La
|
||||
}
|
||||
stmt, args, err := query.
|
||||
Where(or).
|
||||
Where(sq.Eq{CurrentSequenceColInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}).
|
||||
OrderBy(CurrentSequenceColCurrentSequence.identifier()).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
@@ -269,6 +271,10 @@ var (
|
||||
name: "projection_name",
|
||||
table: currentSequencesTable,
|
||||
}
|
||||
CurrentSequenceColInstanceID = Column{
|
||||
name: "instance_id",
|
||||
table: currentSequencesTable,
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
|
@@ -65,7 +65,7 @@ var (
|
||||
" , IFNULL(policy_custom.%[1]s, policy_default.%[1]s) AS %[1]s"+
|
||||
" FROM %[7]s users"+
|
||||
" LEFT JOIN %[8]s policy_custom on policy_custom.%[9]s = users.%[5]s AND policy_custom.%[10]s = users.%[4]s"+
|
||||
" LEFT JOIN %[8]s policy_default on policy_default.%[11]s = true) policy_users"+
|
||||
" LEFT JOIN %[8]s policy_default on policy_default.%[11]s = true AND policy_default.%[10]s = users.%[4]s) policy_users"+
|
||||
" LEFT JOIN %[12]s domains ON policy_users.%[1]s AND policy_users.%[5]s = domains.%[13]s AND policy_users.%[10]s = domains.%[14]s"+
|
||||
");",
|
||||
LoginNamePoliciesMustBeDomainCol,
|
||||
|
Reference in New Issue
Block a user