mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 23:27:23 +00:00
feat(users/v2): return prompt information (#9255)
# Which Problems Are Solved
Add the ability to update the timestamp when MFA initialization was last
skipped.
Get User By ID now also returns the timestamps when MFA setup was last
skipped.
# How the Problems Are Solved
- Add a `HumanMFAInitSkipped` method to the `users/v2` API.
- MFA skipped was already projected in the `auth.users3` table. In this
PR the same column is added to the users projection. Event handling is
kept the same as in the `UserView`:
<details>
62804ca45f/internal/user/repository/view/model/user.go (L243-L377)
</details>
# Additional Changes
- none
# Additional Context
- Closes https://github.com/zitadel/zitadel/issues/9197
This commit is contained in:
parent
df8bac8a28
commit
b6841251b1
@ -1,2 +1,2 @@
|
|||||||
ALTER TABLE IF EXISTS projections.users13_notifications ADD COLUMN IF NOT EXISTS verified_email_lower TEXT GENERATED ALWAYS AS (lower(verified_email)) STORED;
|
ALTER TABLE IF EXISTS projections.users14_notifications ADD COLUMN IF NOT EXISTS verified_email_lower TEXT GENERATED ALWAYS AS (lower(verified_email)) STORED;
|
||||||
CREATE INDEX IF NOT EXISTS users13_notifications_email_search ON projections.users13_notifications (instance_id, verified_email_lower);
|
CREATE INDEX IF NOT EXISTS users14_notifications_email_search ON projections.users14_notifications (instance_id, verified_email_lower);
|
||||||
|
@ -3179,3 +3179,75 @@ func TestServer_VerifyInviteCode(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServer_HumanMFAInitSkipped(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
ctx context.Context
|
||||||
|
req *user.HumanMFAInitSkippedRequest
|
||||||
|
prepare func(request *user.HumanMFAInitSkippedRequest) error
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
want *user.HumanMFAInitSkippedResponse
|
||||||
|
checkState func(t *testing.T, userID string, resp *user.HumanMFAInitSkippedResponse)
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "user not existing",
|
||||||
|
args: args{
|
||||||
|
CTX,
|
||||||
|
&user.HumanMFAInitSkippedRequest{
|
||||||
|
UserId: "notexisting",
|
||||||
|
},
|
||||||
|
func(request *user.HumanMFAInitSkippedRequest) error { return nil },
|
||||||
|
},
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "ok",
|
||||||
|
args: args{
|
||||||
|
CTX,
|
||||||
|
&user.HumanMFAInitSkippedRequest{},
|
||||||
|
func(request *user.HumanMFAInitSkippedRequest) error {
|
||||||
|
resp := Instance.CreateHumanUser(CTX)
|
||||||
|
request.UserId = resp.GetUserId()
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
want: &user.HumanMFAInitSkippedResponse{
|
||||||
|
Details: &object.Details{
|
||||||
|
ChangeDate: timestamppb.Now(),
|
||||||
|
ResourceOwner: Instance.DefaultOrg.Id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
checkState: func(t *testing.T, userID string, resp *user.HumanMFAInitSkippedResponse) {
|
||||||
|
state, err := Client.GetUserByID(CTX, &user.GetUserByIDRequest{
|
||||||
|
UserId: userID,
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
integration.EqualProto(t,
|
||||||
|
state.GetUser().GetHuman().GetMfaInitSkipped(),
|
||||||
|
resp.GetDetails().GetChangeDate(),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
err := tt.args.prepare(tt.args.req)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
got, err := Client.HumanMFAInitSkipped(tt.args.ctx, tt.args.req)
|
||||||
|
if tt.wantErr {
|
||||||
|
require.Error(t, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
require.NoError(t, err)
|
||||||
|
integration.AssertDetails(t, tt.want, got)
|
||||||
|
if tt.checkState != nil {
|
||||||
|
tt.checkState(t, tt.args.req.GetUserId(), got)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -82,10 +82,13 @@ func userTypeToPb(userQ *query.User, assetPrefix string) user.UserType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func humanToPb(userQ *query.Human, assetPrefix, owner string) *user.HumanUser {
|
func humanToPb(userQ *query.Human, assetPrefix, owner string) *user.HumanUser {
|
||||||
var passwordChanged *timestamppb.Timestamp
|
var passwordChanged, mfaInitSkipped *timestamppb.Timestamp
|
||||||
if !userQ.PasswordChanged.IsZero() {
|
if !userQ.PasswordChanged.IsZero() {
|
||||||
passwordChanged = timestamppb.New(userQ.PasswordChanged)
|
passwordChanged = timestamppb.New(userQ.PasswordChanged)
|
||||||
}
|
}
|
||||||
|
if !userQ.MFAInitSkipped.IsZero() {
|
||||||
|
mfaInitSkipped = timestamppb.New(userQ.MFAInitSkipped)
|
||||||
|
}
|
||||||
return &user.HumanUser{
|
return &user.HumanUser{
|
||||||
Profile: &user.HumanProfile{
|
Profile: &user.HumanProfile{
|
||||||
GivenName: userQ.FirstName,
|
GivenName: userQ.FirstName,
|
||||||
@ -106,6 +109,7 @@ func humanToPb(userQ *query.Human, assetPrefix, owner string) *user.HumanUser {
|
|||||||
},
|
},
|
||||||
PasswordChangeRequired: userQ.PasswordChangeRequired,
|
PasswordChangeRequired: userQ.PasswordChangeRequired,
|
||||||
PasswordChanged: passwordChanged,
|
PasswordChanged: passwordChanged,
|
||||||
|
MfaInitSkipped: mfaInitSkipped,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,3 +711,13 @@ func createInviteCodeRequestToCommand(req *user.CreateInviteCodeRequest) (*comma
|
|||||||
return &command.CreateUserInvite{UserID: req.GetUserId()}, nil
|
return &command.CreateUserInvite{UserID: req.GetUserId()}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) HumanMFAInitSkipped(ctx context.Context, req *user.HumanMFAInitSkippedRequest) (_ *user.HumanMFAInitSkippedResponse, err error) {
|
||||||
|
details, err := s.command.HumanMFAInitSkippedV2(ctx, req.UserId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &user.HumanMFAInitSkippedResponse{
|
||||||
|
Details: object.DomainToDetailsPb(details),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
@ -491,6 +491,28 @@ func (c *Commands) changeUserPassword(ctx context.Context, cmds []eventstore.Com
|
|||||||
return cmds, err
|
return cmds, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Commands) HumanMFAInitSkippedV2(ctx context.Context, userID string) (*domain.ObjectDetails, error) {
|
||||||
|
if userID == "" {
|
||||||
|
return nil, zerrors.ThrowInvalidArgument(nil, "COMMAND-Wei5kooz1i", "Errors.User.UserIDMissing")
|
||||||
|
}
|
||||||
|
|
||||||
|
existingHuman, err := c.userStateWriteModel(ctx, userID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !isUserStateExists(existingHuman.UserState) {
|
||||||
|
return nil, zerrors.ThrowNotFound(nil, "COMMAND-auj6jeBei4", "Errors.User.NotFound")
|
||||||
|
}
|
||||||
|
if err := c.checkPermissionUpdateUser(ctx, existingHuman.ResourceOwner, existingHuman.AggregateID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := c.pushAppendAndReduce(ctx, existingHuman, user.NewHumanMFAInitSkippedEvent(ctx, &existingHuman.Aggregate().Aggregate)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return writeModelToObjectDetails(&existingHuman.WriteModel), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Commands) userExistsWriteModel(ctx context.Context, userID string) (writeModel *UserV2WriteModel, err error) {
|
func (c *Commands) userExistsWriteModel(ctx context.Context, userID string) (writeModel *UserV2WriteModel, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
select u.id as user_id, u.resource_owner, u.username, m.access_token_type, k.public_key
|
select u.id as user_id, u.resource_owner, u.username, m.access_token_type, k.public_key
|
||||||
from projections.authn_keys2 k
|
from projections.authn_keys2 k
|
||||||
join projections.users13 u
|
join projections.users14 u
|
||||||
on k.instance_id = u.instance_id
|
on k.instance_id = u.instance_id
|
||||||
and k.identifier = u.id
|
and k.identifier = u.id
|
||||||
join projections.users13_machines m
|
join projections.users14_machines m
|
||||||
on u.instance_id = m.instance_id
|
on u.instance_id = m.instance_id
|
||||||
and u.id = m.user_id
|
and u.id = m.user_id
|
||||||
where k.instance_id = $1
|
where k.instance_id = $1
|
||||||
|
@ -22,21 +22,21 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names3.login_name" +
|
", projections.login_names3.login_name" +
|
||||||
", projections.users13_humans.email" +
|
", projections.users14_humans.email" +
|
||||||
", projections.users13_humans.first_name" +
|
", projections.users14_humans.first_name" +
|
||||||
", projections.users13_humans.last_name" +
|
", projections.users14_humans.last_name" +
|
||||||
", projections.users13_humans.display_name" +
|
", projections.users14_humans.display_name" +
|
||||||
", projections.users13_machines.name" +
|
", projections.users14_machines.name" +
|
||||||
", projections.users13_humans.avatar_key" +
|
", projections.users14_humans.avatar_key" +
|
||||||
", projections.users13.type" +
|
", projections.users14.type" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.instance_members4 AS members " +
|
"FROM projections.instance_members4 AS members " +
|
||||||
"LEFT JOIN projections.users13_humans " +
|
"LEFT JOIN projections.users14_humans " +
|
||||||
"ON members.user_id = projections.users13_humans.user_id AND members.instance_id = projections.users13_humans.instance_id " +
|
"ON members.user_id = projections.users14_humans.user_id AND members.instance_id = projections.users14_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users13_machines " +
|
"LEFT JOIN projections.users14_machines " +
|
||||||
"ON members.user_id = projections.users13_machines.user_id AND members.instance_id = projections.users13_machines.instance_id " +
|
"ON members.user_id = projections.users14_machines.user_id AND members.instance_id = projections.users14_machines.instance_id " +
|
||||||
"LEFT JOIN projections.users13 " +
|
"LEFT JOIN projections.users14 " +
|
||||||
"ON members.user_id = projections.users13.id AND members.instance_id = projections.users13.instance_id " +
|
"ON members.user_id = projections.users14.id AND members.instance_id = projections.users14.instance_id " +
|
||||||
"LEFT JOIN projections.login_names3 " +
|
"LEFT JOIN projections.login_names3 " +
|
||||||
"ON members.user_id = projections.login_names3.user_id AND members.instance_id = projections.login_names3.instance_id " +
|
"ON members.user_id = projections.login_names3.user_id AND members.instance_id = projections.login_names3.instance_id " +
|
||||||
"AS OF SYSTEM TIME '-1 ms' " +
|
"AS OF SYSTEM TIME '-1 ms' " +
|
||||||
|
@ -22,24 +22,24 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names3.login_name" +
|
", projections.login_names3.login_name" +
|
||||||
", projections.users13_humans.email" +
|
", projections.users14_humans.email" +
|
||||||
", projections.users13_humans.first_name" +
|
", projections.users14_humans.first_name" +
|
||||||
", projections.users13_humans.last_name" +
|
", projections.users14_humans.last_name" +
|
||||||
", projections.users13_humans.display_name" +
|
", projections.users14_humans.display_name" +
|
||||||
", projections.users13_machines.name" +
|
", projections.users14_machines.name" +
|
||||||
", projections.users13_humans.avatar_key" +
|
", projections.users14_humans.avatar_key" +
|
||||||
", projections.users13.type" +
|
", projections.users14.type" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.org_members4 AS members " +
|
"FROM projections.org_members4 AS members " +
|
||||||
"LEFT JOIN projections.users13_humans " +
|
"LEFT JOIN projections.users14_humans " +
|
||||||
"ON members.user_id = projections.users13_humans.user_id " +
|
"ON members.user_id = projections.users14_humans.user_id " +
|
||||||
"AND members.instance_id = projections.users13_humans.instance_id " +
|
"AND members.instance_id = projections.users14_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users13_machines " +
|
"LEFT JOIN projections.users14_machines " +
|
||||||
"ON members.user_id = projections.users13_machines.user_id " +
|
"ON members.user_id = projections.users14_machines.user_id " +
|
||||||
"AND members.instance_id = projections.users13_machines.instance_id " +
|
"AND members.instance_id = projections.users14_machines.instance_id " +
|
||||||
"LEFT JOIN projections.users13 " +
|
"LEFT JOIN projections.users14 " +
|
||||||
"ON members.user_id = projections.users13.id " +
|
"ON members.user_id = projections.users14.id " +
|
||||||
"AND members.instance_id = projections.users13.instance_id " +
|
"AND members.instance_id = projections.users14.instance_id " +
|
||||||
"LEFT JOIN projections.login_names3 " +
|
"LEFT JOIN projections.login_names3 " +
|
||||||
"ON members.user_id = projections.login_names3.user_id " +
|
"ON members.user_id = projections.login_names3.user_id " +
|
||||||
"AND members.instance_id = projections.login_names3.instance_id " +
|
"AND members.instance_id = projections.login_names3.instance_id " +
|
||||||
|
@ -22,24 +22,24 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names3.login_name" +
|
", projections.login_names3.login_name" +
|
||||||
", projections.users13_humans.email" +
|
", projections.users14_humans.email" +
|
||||||
", projections.users13_humans.first_name" +
|
", projections.users14_humans.first_name" +
|
||||||
", projections.users13_humans.last_name" +
|
", projections.users14_humans.last_name" +
|
||||||
", projections.users13_humans.display_name" +
|
", projections.users14_humans.display_name" +
|
||||||
", projections.users13_machines.name" +
|
", projections.users14_machines.name" +
|
||||||
", projections.users13_humans.avatar_key" +
|
", projections.users14_humans.avatar_key" +
|
||||||
", projections.users13.type" +
|
", projections.users14.type" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.project_grant_members4 AS members " +
|
"FROM projections.project_grant_members4 AS members " +
|
||||||
"LEFT JOIN projections.users13_humans " +
|
"LEFT JOIN projections.users14_humans " +
|
||||||
"ON members.user_id = projections.users13_humans.user_id " +
|
"ON members.user_id = projections.users14_humans.user_id " +
|
||||||
"AND members.instance_id = projections.users13_humans.instance_id " +
|
"AND members.instance_id = projections.users14_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users13_machines " +
|
"LEFT JOIN projections.users14_machines " +
|
||||||
"ON members.user_id = projections.users13_machines.user_id " +
|
"ON members.user_id = projections.users14_machines.user_id " +
|
||||||
"AND members.instance_id = projections.users13_machines.instance_id " +
|
"AND members.instance_id = projections.users14_machines.instance_id " +
|
||||||
"LEFT JOIN projections.users13 " +
|
"LEFT JOIN projections.users14 " +
|
||||||
"ON members.user_id = projections.users13.id " +
|
"ON members.user_id = projections.users14.id " +
|
||||||
"AND members.instance_id = projections.users13.instance_id " +
|
"AND members.instance_id = projections.users14.instance_id " +
|
||||||
"LEFT JOIN projections.login_names3 " +
|
"LEFT JOIN projections.login_names3 " +
|
||||||
"ON members.user_id = projections.login_names3.user_id " +
|
"ON members.user_id = projections.login_names3.user_id " +
|
||||||
"AND members.instance_id = projections.login_names3.instance_id " +
|
"AND members.instance_id = projections.login_names3.instance_id " +
|
||||||
|
@ -22,24 +22,24 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names3.login_name" +
|
", projections.login_names3.login_name" +
|
||||||
", projections.users13_humans.email" +
|
", projections.users14_humans.email" +
|
||||||
", projections.users13_humans.first_name" +
|
", projections.users14_humans.first_name" +
|
||||||
", projections.users13_humans.last_name" +
|
", projections.users14_humans.last_name" +
|
||||||
", projections.users13_humans.display_name" +
|
", projections.users14_humans.display_name" +
|
||||||
", projections.users13_machines.name" +
|
", projections.users14_machines.name" +
|
||||||
", projections.users13_humans.avatar_key" +
|
", projections.users14_humans.avatar_key" +
|
||||||
", projections.users13.type" +
|
", projections.users14.type" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.project_members4 AS members " +
|
"FROM projections.project_members4 AS members " +
|
||||||
"LEFT JOIN projections.users13_humans " +
|
"LEFT JOIN projections.users14_humans " +
|
||||||
"ON members.user_id = projections.users13_humans.user_id " +
|
"ON members.user_id = projections.users14_humans.user_id " +
|
||||||
"AND members.instance_id = projections.users13_humans.instance_id " +
|
"AND members.instance_id = projections.users14_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users13_machines " +
|
"LEFT JOIN projections.users14_machines " +
|
||||||
"ON members.user_id = projections.users13_machines.user_id " +
|
"ON members.user_id = projections.users14_machines.user_id " +
|
||||||
"AND members.instance_id = projections.users13_machines.instance_id " +
|
"AND members.instance_id = projections.users14_machines.instance_id " +
|
||||||
"LEFT JOIN projections.users13 " +
|
"LEFT JOIN projections.users14 " +
|
||||||
"ON members.user_id = projections.users13.id " +
|
"ON members.user_id = projections.users14.id " +
|
||||||
"AND members.instance_id = projections.users13.instance_id " +
|
"AND members.instance_id = projections.users14.instance_id " +
|
||||||
"LEFT JOIN projections.login_names3 " +
|
"LEFT JOIN projections.login_names3 " +
|
||||||
"ON members.user_id = projections.login_names3.user_id " +
|
"ON members.user_id = projections.login_names3.user_id " +
|
||||||
"AND members.instance_id = projections.login_names3.instance_id " +
|
"AND members.instance_id = projections.login_names3.instance_id " +
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UserTable = "projections.users13"
|
UserTable = "projections.users14"
|
||||||
UserHumanTable = UserTable + "_" + UserHumanSuffix
|
UserHumanTable = UserTable + "_" + UserHumanSuffix
|
||||||
UserMachineTable = UserTable + "_" + UserMachineSuffix
|
UserMachineTable = UserTable + "_" + UserMachineSuffix
|
||||||
UserNotifyTable = UserTable + "_" + UserNotifySuffix
|
UserNotifyTable = UserTable + "_" + UserNotifySuffix
|
||||||
@ -36,6 +36,7 @@ const (
|
|||||||
HumanUserInstanceIDCol = "instance_id"
|
HumanUserInstanceIDCol = "instance_id"
|
||||||
HumanPasswordChangeRequired = "password_change_required"
|
HumanPasswordChangeRequired = "password_change_required"
|
||||||
HumanPasswordChanged = "password_changed"
|
HumanPasswordChanged = "password_changed"
|
||||||
|
HumanMFAInitSkipped = "mfa_init_skipped"
|
||||||
|
|
||||||
// profile
|
// profile
|
||||||
HumanFirstNameCol = "first_name"
|
HumanFirstNameCol = "first_name"
|
||||||
@ -118,6 +119,7 @@ func (*userProjection) Init() *old_handler.Check {
|
|||||||
handler.NewColumn(HumanIsPhoneVerifiedCol, handler.ColumnTypeBool, handler.Nullable()),
|
handler.NewColumn(HumanIsPhoneVerifiedCol, handler.ColumnTypeBool, handler.Nullable()),
|
||||||
handler.NewColumn(HumanPasswordChangeRequired, handler.ColumnTypeBool),
|
handler.NewColumn(HumanPasswordChangeRequired, handler.ColumnTypeBool),
|
||||||
handler.NewColumn(HumanPasswordChanged, handler.ColumnTypeTimestamp, handler.Nullable()),
|
handler.NewColumn(HumanPasswordChanged, handler.ColumnTypeTimestamp, handler.Nullable()),
|
||||||
|
handler.NewColumn(HumanMFAInitSkipped, handler.ColumnTypeTimestamp, handler.Nullable()),
|
||||||
},
|
},
|
||||||
handler.NewPrimaryKey(HumanUserInstanceIDCol, HumanUserIDCol),
|
handler.NewPrimaryKey(HumanUserInstanceIDCol, HumanUserIDCol),
|
||||||
UserHumanSuffix,
|
UserHumanSuffix,
|
||||||
@ -296,6 +298,38 @@ func (p *userProjection) Reducers() []handler.AggregateReducer {
|
|||||||
Event: user.MachineSecretRemovedType,
|
Event: user.MachineSecretRemovedType,
|
||||||
Reduce: p.reduceMachineSecretRemoved,
|
Reduce: p.reduceMachineSecretRemoved,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Event: user.UserV1MFAOTPVerifiedType,
|
||||||
|
Reduce: p.reduceUnsetMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.HumanMFAOTPVerifiedType,
|
||||||
|
Reduce: p.reduceUnsetMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.HumanOTPSMSAddedType,
|
||||||
|
Reduce: p.reduceUnsetMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.HumanOTPEmailAddedType,
|
||||||
|
Reduce: p.reduceUnsetMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.HumanU2FTokenVerifiedType,
|
||||||
|
Reduce: p.reduceUnsetMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.HumanPasswordlessTokenVerifiedType,
|
||||||
|
Reduce: p.reduceUnsetMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.UserV1MFAInitSkippedType,
|
||||||
|
Reduce: p.reduceMFAInitSkipped,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: user.HumanMFAInitSkippedType,
|
||||||
|
Reduce: p.reduceMFAInitSkipped,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1114,6 +1148,51 @@ func (p *userProjection) reduceMachineChanged(event eventstore.Event) (*handler.
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *userProjection) reduceUnsetMFAInitSkipped(e eventstore.Event) (*handler.Statement, error) {
|
||||||
|
switch e.(type) {
|
||||||
|
default:
|
||||||
|
return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-ojrf6", "reduce.wrong.event.type %s", e.Type())
|
||||||
|
case *user.HumanOTPVerifiedEvent,
|
||||||
|
*user.HumanOTPSMSAddedEvent,
|
||||||
|
*user.HumanOTPEmailAddedEvent,
|
||||||
|
*user.HumanU2FVerifiedEvent,
|
||||||
|
*user.HumanPasswordlessVerifiedEvent:
|
||||||
|
}
|
||||||
|
|
||||||
|
return handler.NewUpdateStatement(
|
||||||
|
e,
|
||||||
|
[]handler.Column{
|
||||||
|
handler.NewCol(HumanMFAInitSkipped, sql.NullTime{}),
|
||||||
|
},
|
||||||
|
[]handler.Condition{
|
||||||
|
handler.NewCond(HumanUserIDCol, e.Aggregate().ID),
|
||||||
|
handler.NewCond(HumanUserInstanceIDCol, e.Aggregate().InstanceID),
|
||||||
|
},
|
||||||
|
handler.WithTableSuffix(UserHumanSuffix),
|
||||||
|
), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *userProjection) reduceMFAInitSkipped(event eventstore.Event) (*handler.Statement, error) {
|
||||||
|
e, ok := event.(*user.HumanMFAInitSkippedEvent)
|
||||||
|
if !ok {
|
||||||
|
return nil, zerrors.ThrowInvalidArgumentf(nil, "HANDL-qYHvj", "reduce.wrong.event.type %s", user.MachineChangedEventType)
|
||||||
|
}
|
||||||
|
return handler.NewUpdateStatement(
|
||||||
|
e,
|
||||||
|
[]handler.Column{
|
||||||
|
handler.NewCol(HumanMFAInitSkipped, sql.NullTime{
|
||||||
|
Time: e.CreatedAt(),
|
||||||
|
Valid: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
[]handler.Condition{
|
||||||
|
handler.NewCond(HumanUserIDCol, e.Aggregate().ID),
|
||||||
|
handler.NewCond(HumanUserInstanceIDCol, e.Aggregate().InstanceID),
|
||||||
|
},
|
||||||
|
handler.WithTableSuffix(UserHumanSuffix),
|
||||||
|
), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (p *userProjection) reduceOwnerRemoved(event eventstore.Event) (*handler.Statement, error) {
|
func (p *userProjection) reduceOwnerRemoved(event eventstore.Event) (*handler.Statement, error) {
|
||||||
e, ok := event.(*org.OrgRemovedEvent)
|
e, ok := event.(*org.OrgRemovedEvent)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -54,7 +54,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -68,7 +68,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
expectedStmt: "INSERT INTO projections.users14_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -85,7 +85,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -126,7 +126,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -140,7 +140,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
expectedStmt: "INSERT INTO projections.users14_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -157,7 +157,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -193,7 +193,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -207,7 +207,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
expectedStmt: "INSERT INTO projections.users14_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -224,7 +224,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -266,7 +266,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -280,7 +280,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
expectedStmt: "INSERT INTO projections.users14_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -297,7 +297,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -338,7 +338,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -352,7 +352,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
expectedStmt: "INSERT INTO projections.users14_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -369,7 +369,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -405,7 +405,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -419,7 +419,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
expectedStmt: "INSERT INTO projections.users14_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone, password_change_required, password_changed) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -436,7 +436,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -466,7 +466,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.UserStateInitial,
|
domain.UserStateInitial,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -494,7 +494,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.UserStateInitial,
|
domain.UserStateInitial,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -522,7 +522,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.UserStateActive,
|
domain.UserStateActive,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -550,7 +550,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.UserStateActive,
|
domain.UserStateActive,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -578,7 +578,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
domain.UserStateLocked,
|
domain.UserStateLocked,
|
||||||
@ -608,7 +608,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
domain.UserStateActive,
|
domain.UserStateActive,
|
||||||
@ -638,7 +638,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
domain.UserStateInactive,
|
domain.UserStateInactive,
|
||||||
@ -668,7 +668,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
domain.UserStateActive,
|
domain.UserStateActive,
|
||||||
@ -698,7 +698,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.users13 WHERE (id = $1) AND (instance_id = $2)",
|
expectedStmt: "DELETE FROM projections.users14 WHERE (id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -727,7 +727,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
"username",
|
"username",
|
||||||
@ -759,7 +759,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
"id@temporary.domain",
|
"id@temporary.domain",
|
||||||
@ -796,7 +796,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -805,7 +805,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)",
|
expectedStmt: "UPDATE projections.users14_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"first-name",
|
"first-name",
|
||||||
"last-name",
|
"last-name",
|
||||||
@ -845,7 +845,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -854,7 +854,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)",
|
expectedStmt: "UPDATE projections.users14_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"first-name",
|
"first-name",
|
||||||
"last-name",
|
"last-name",
|
||||||
@ -889,7 +889,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -898,7 +898,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.PhoneNumber("+41 00 000 00 00"),
|
domain.PhoneNumber("+41 00 000 00 00"),
|
||||||
false,
|
false,
|
||||||
@ -907,7 +907,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
&sql.NullString{String: "+41 00 000 00 00", Valid: true},
|
&sql.NullString{String: "+41 00 000 00 00", Valid: true},
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -937,7 +937,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -946,7 +946,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.PhoneNumber("+41 00 000 00 00"),
|
domain.PhoneNumber("+41 00 000 00 00"),
|
||||||
false,
|
false,
|
||||||
@ -955,7 +955,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
&sql.NullString{String: "+41 00 000 00 00", Valid: true},
|
&sql.NullString{String: "+41 00 000 00 00", Valid: true},
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -983,7 +983,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -992,7 +992,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@ -1001,7 +1001,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@ -1030,7 +1030,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1039,7 +1039,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@ -1048,7 +1048,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@ -1077,7 +1077,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1086,7 +1086,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1094,7 +1094,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users14_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1121,7 +1121,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1130,7 +1130,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1138,7 +1138,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users14_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1167,7 +1167,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1176,7 +1176,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.EmailAddress("email@zitadel.com"),
|
domain.EmailAddress("email@zitadel.com"),
|
||||||
false,
|
false,
|
||||||
@ -1185,7 +1185,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
&sql.NullString{String: "email@zitadel.com", Valid: true},
|
&sql.NullString{String: "email@zitadel.com", Valid: true},
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1215,7 +1215,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1224,7 +1224,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.EmailAddress("email@zitadel.com"),
|
domain.EmailAddress("email@zitadel.com"),
|
||||||
false,
|
false,
|
||||||
@ -1233,7 +1233,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
&sql.NullString{String: "email@zitadel.com", Valid: true},
|
&sql.NullString{String: "email@zitadel.com", Valid: true},
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1261,7 +1261,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1270,7 +1270,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1278,7 +1278,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users14_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1305,7 +1305,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1314,7 +1314,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1322,7 +1322,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users14_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1351,7 +1351,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1360,7 +1360,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"users/agg-id/avatar",
|
"users/agg-id/avatar",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1388,7 +1388,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1397,7 +1397,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
nil,
|
nil,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1428,7 +1428,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (password_change_required, password_changed) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (password_change_required, password_changed) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
&sql.NullTime{Time: testNow, Valid: true},
|
&sql.NullTime{Time: testNow, Valid: true},
|
||||||
@ -1437,7 +1437,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET password_set = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_notifications SET password_set = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1468,7 +1468,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_humans SET (password_change_required, password_changed) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_humans SET (password_change_required, password_changed) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
false,
|
false,
|
||||||
&sql.NullTime{Time: testNow, Valid: true},
|
&sql.NullTime{Time: testNow, Valid: true},
|
||||||
@ -1477,7 +1477,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_notifications SET password_set = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_notifications SET password_set = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
true,
|
true,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1508,7 +1508,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -1522,7 +1522,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1556,7 +1556,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.users14 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -1570,7 +1570,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users13_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users14_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1603,7 +1603,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1612,7 +1612,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET (name, description) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14_machines SET (name, description) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"machine-name",
|
"machine-name",
|
||||||
"description",
|
"description",
|
||||||
@ -1643,7 +1643,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1652,7 +1652,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET name = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_machines SET name = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"machine-name",
|
"machine-name",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1682,7 +1682,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1691,7 +1691,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET description = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_machines SET description = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"description",
|
"description",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1740,7 +1740,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1749,7 +1749,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"secret",
|
"secret",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1779,7 +1779,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1788,7 +1788,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"secret",
|
"secret",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1818,7 +1818,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1827,7 +1827,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"secret",
|
"secret",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1855,7 +1855,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users14 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1864,7 +1864,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users13_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users14_machines SET secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
nil,
|
nil,
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1875,6 +1875,66 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "reduceUnsetMFAInitSkipped",
|
||||||
|
args: args{
|
||||||
|
event: getEvent(
|
||||||
|
testEvent(
|
||||||
|
user.HumanMFAOTPVerifiedType,
|
||||||
|
user.AggregateType,
|
||||||
|
[]byte(`{}`),
|
||||||
|
), user.HumanOTPVerifiedEventMapper),
|
||||||
|
},
|
||||||
|
reduce: (&userProjection{}).reduceUnsetMFAInitSkipped,
|
||||||
|
want: wantReduce{
|
||||||
|
aggregateType: user.AggregateType,
|
||||||
|
sequence: 15,
|
||||||
|
executer: &testExecuter{
|
||||||
|
executions: []execution{
|
||||||
|
{
|
||||||
|
expectedStmt: "UPDATE projections.users14_humans SET mfa_init_skipped = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
|
expectedArgs: []interface{}{
|
||||||
|
sql.NullTime{},
|
||||||
|
"agg-id",
|
||||||
|
"instance-id",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "reduceMFAInitSkipped",
|
||||||
|
args: args{
|
||||||
|
event: getEvent(
|
||||||
|
timedTestEvent(
|
||||||
|
user.HumanMFAInitSkippedType,
|
||||||
|
user.AggregateType,
|
||||||
|
[]byte(`{}`),
|
||||||
|
testNow,
|
||||||
|
), user.HumanMFAInitSkippedEventMapper),
|
||||||
|
},
|
||||||
|
reduce: (&userProjection{}).reduceMFAInitSkipped,
|
||||||
|
want: wantReduce{
|
||||||
|
aggregateType: user.AggregateType,
|
||||||
|
sequence: 15,
|
||||||
|
executer: &testExecuter{
|
||||||
|
executions: []execution{
|
||||||
|
{
|
||||||
|
expectedStmt: "UPDATE projections.users14_humans SET mfa_init_skipped = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
|
expectedArgs: []interface{}{
|
||||||
|
sql.NullTime{
|
||||||
|
Time: testNow,
|
||||||
|
Valid: true,
|
||||||
|
},
|
||||||
|
"agg-id",
|
||||||
|
"instance-id",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "org reduceOwnerRemoved",
|
name: "org reduceOwnerRemoved",
|
||||||
reduce: (&userProjection{}).reduceOwnerRemoved,
|
reduce: (&userProjection{}).reduceOwnerRemoved,
|
||||||
@ -1892,7 +1952,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.users13 WHERE (instance_id = $1) AND (resource_owner = $2)",
|
expectedStmt: "DELETE FROM projections.users14 WHERE (instance_id = $1) AND (resource_owner = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"instance-id",
|
"instance-id",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1919,7 +1979,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.users13 WHERE (instance_id = $1)",
|
expectedStmt: "DELETE FROM projections.users14 WHERE (instance_id = $1)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,7 @@ var (
|
|||||||
` projections.sessions8.user_resource_owner,` +
|
` projections.sessions8.user_resource_owner,` +
|
||||||
` projections.sessions8.user_checked_at,` +
|
` projections.sessions8.user_checked_at,` +
|
||||||
` projections.login_names3.login_name,` +
|
` projections.login_names3.login_name,` +
|
||||||
` projections.users13_humans.display_name,` +
|
` projections.users14_humans.display_name,` +
|
||||||
` projections.sessions8.password_checked_at,` +
|
` projections.sessions8.password_checked_at,` +
|
||||||
` projections.sessions8.intent_checked_at,` +
|
` projections.sessions8.intent_checked_at,` +
|
||||||
` projections.sessions8.webauthn_checked_at,` +
|
` projections.sessions8.webauthn_checked_at,` +
|
||||||
@ -49,8 +49,8 @@ var (
|
|||||||
` projections.sessions8.expiration` +
|
` projections.sessions8.expiration` +
|
||||||
` FROM projections.sessions8` +
|
` FROM projections.sessions8` +
|
||||||
` LEFT JOIN projections.login_names3 ON projections.sessions8.user_id = projections.login_names3.user_id AND projections.sessions8.instance_id = projections.login_names3.instance_id` +
|
` LEFT JOIN projections.login_names3 ON projections.sessions8.user_id = projections.login_names3.user_id AND projections.sessions8.instance_id = projections.login_names3.instance_id` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.sessions8.user_id = projections.users13_humans.user_id AND projections.sessions8.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.sessions8.user_id = projections.users14_humans.user_id AND projections.sessions8.instance_id = projections.users14_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users13 ON projections.sessions8.user_id = projections.users13.id AND projections.sessions8.instance_id = projections.users13.instance_id` +
|
` LEFT JOIN projections.users14 ON projections.sessions8.user_id = projections.users14.id AND projections.sessions8.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
expectedSessionsQuery = regexp.QuoteMeta(`SELECT projections.sessions8.id,` +
|
expectedSessionsQuery = regexp.QuoteMeta(`SELECT projections.sessions8.id,` +
|
||||||
` projections.sessions8.creation_date,` +
|
` projections.sessions8.creation_date,` +
|
||||||
@ -63,7 +63,7 @@ var (
|
|||||||
` projections.sessions8.user_resource_owner,` +
|
` projections.sessions8.user_resource_owner,` +
|
||||||
` projections.sessions8.user_checked_at,` +
|
` projections.sessions8.user_checked_at,` +
|
||||||
` projections.login_names3.login_name,` +
|
` projections.login_names3.login_name,` +
|
||||||
` projections.users13_humans.display_name,` +
|
` projections.users14_humans.display_name,` +
|
||||||
` projections.sessions8.password_checked_at,` +
|
` projections.sessions8.password_checked_at,` +
|
||||||
` projections.sessions8.intent_checked_at,` +
|
` projections.sessions8.intent_checked_at,` +
|
||||||
` projections.sessions8.webauthn_checked_at,` +
|
` projections.sessions8.webauthn_checked_at,` +
|
||||||
@ -80,8 +80,8 @@ var (
|
|||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.sessions8` +
|
` FROM projections.sessions8` +
|
||||||
` LEFT JOIN projections.login_names3 ON projections.sessions8.user_id = projections.login_names3.user_id AND projections.sessions8.instance_id = projections.login_names3.instance_id` +
|
` LEFT JOIN projections.login_names3 ON projections.sessions8.user_id = projections.login_names3.user_id AND projections.sessions8.instance_id = projections.login_names3.instance_id` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.sessions8.user_id = projections.users13_humans.user_id AND projections.sessions8.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.sessions8.user_id = projections.users14_humans.user_id AND projections.sessions8.instance_id = projections.users14_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users13 ON projections.sessions8.user_id = projections.users13.id AND projections.sessions8.instance_id = projections.users13.instance_id` +
|
` LEFT JOIN projections.users14 ON projections.sessions8.user_id = projections.users14.id AND projections.sessions8.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
|
|
||||||
sessionCols = []string{
|
sessionCols = []string{
|
||||||
|
@ -55,6 +55,7 @@ type Human struct {
|
|||||||
IsPhoneVerified bool `json:"is_phone_verified,omitempty"`
|
IsPhoneVerified bool `json:"is_phone_verified,omitempty"`
|
||||||
PasswordChangeRequired bool `json:"password_change_required,omitempty"`
|
PasswordChangeRequired bool `json:"password_change_required,omitempty"`
|
||||||
PasswordChanged time.Time `json:"password_changed,omitempty"`
|
PasswordChanged time.Time `json:"password_changed,omitempty"`
|
||||||
|
MFAInitSkipped time.Time `json:"mfa_init_skipped,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Profile struct {
|
type Profile struct {
|
||||||
@ -271,6 +272,10 @@ var (
|
|||||||
name: projection.HumanPasswordChanged,
|
name: projection.HumanPasswordChanged,
|
||||||
table: humanTable,
|
table: humanTable,
|
||||||
}
|
}
|
||||||
|
HumanMFAInitSkippedCol = Column{
|
||||||
|
name: projection.HumanMFAInitSkipped,
|
||||||
|
table: humanTable,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -872,6 +877,7 @@ func scanUser(row *sql.Row) (*User, error) {
|
|||||||
isPhoneVerified := sql.NullBool{}
|
isPhoneVerified := sql.NullBool{}
|
||||||
passwordChangeRequired := sql.NullBool{}
|
passwordChangeRequired := sql.NullBool{}
|
||||||
passwordChanged := sql.NullTime{}
|
passwordChanged := sql.NullTime{}
|
||||||
|
mfaInitSkipped := sql.NullTime{}
|
||||||
|
|
||||||
machineID := sql.NullString{}
|
machineID := sql.NullString{}
|
||||||
name := sql.NullString{}
|
name := sql.NullString{}
|
||||||
@ -904,6 +910,7 @@ func scanUser(row *sql.Row) (*User, error) {
|
|||||||
&isPhoneVerified,
|
&isPhoneVerified,
|
||||||
&passwordChangeRequired,
|
&passwordChangeRequired,
|
||||||
&passwordChanged,
|
&passwordChanged,
|
||||||
|
&mfaInitSkipped,
|
||||||
&machineID,
|
&machineID,
|
||||||
&name,
|
&name,
|
||||||
&description,
|
&description,
|
||||||
@ -936,6 +943,7 @@ func scanUser(row *sql.Row) (*User, error) {
|
|||||||
IsPhoneVerified: isPhoneVerified.Bool,
|
IsPhoneVerified: isPhoneVerified.Bool,
|
||||||
PasswordChangeRequired: passwordChangeRequired.Bool,
|
PasswordChangeRequired: passwordChangeRequired.Bool,
|
||||||
PasswordChanged: passwordChanged.Time,
|
PasswordChanged: passwordChanged.Time,
|
||||||
|
MFAInitSkipped: mfaInitSkipped.Time,
|
||||||
}
|
}
|
||||||
} else if machineID.Valid {
|
} else if machineID.Valid {
|
||||||
u.Machine = &Machine{
|
u.Machine = &Machine{
|
||||||
@ -982,6 +990,7 @@ func prepareUserQuery(ctx context.Context, db prepareDatabase) (sq.SelectBuilder
|
|||||||
HumanIsPhoneVerifiedCol.identifier(),
|
HumanIsPhoneVerifiedCol.identifier(),
|
||||||
HumanPasswordChangeRequiredCol.identifier(),
|
HumanPasswordChangeRequiredCol.identifier(),
|
||||||
HumanPasswordChangedCol.identifier(),
|
HumanPasswordChangedCol.identifier(),
|
||||||
|
HumanMFAInitSkippedCol.identifier(),
|
||||||
MachineUserIDCol.identifier(),
|
MachineUserIDCol.identifier(),
|
||||||
MachineNameCol.identifier(),
|
MachineNameCol.identifier(),
|
||||||
MachineDescriptionCol.identifier(),
|
MachineDescriptionCol.identifier(),
|
||||||
|
@ -205,63 +205,63 @@ var (
|
|||||||
"method_type",
|
"method_type",
|
||||||
"count",
|
"count",
|
||||||
}
|
}
|
||||||
prepareActiveAuthMethodTypesStmt = `SELECT projections.users13_notifications.password_set,` +
|
prepareActiveAuthMethodTypesStmt = `SELECT projections.users14_notifications.password_set,` +
|
||||||
` auth_method_types.method_type,` +
|
` auth_method_types.method_type,` +
|
||||||
` user_idps_count.count` +
|
` user_idps_count.count` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_notifications ON projections.users13.id = projections.users13_notifications.user_id AND projections.users13.instance_id = projections.users13_notifications.instance_id` +
|
` LEFT JOIN projections.users14_notifications ON projections.users14.id = projections.users14_notifications.user_id AND projections.users14.instance_id = projections.users14_notifications.instance_id` +
|
||||||
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods5 AS auth_method_types` +
|
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods5 AS auth_method_types` +
|
||||||
` WHERE auth_method_types.state = $1) AS auth_method_types` +
|
` WHERE auth_method_types.state = $1) AS auth_method_types` +
|
||||||
` ON auth_method_types.user_id = projections.users13.id AND auth_method_types.instance_id = projections.users13.instance_id` +
|
` ON auth_method_types.user_id = projections.users14.id AND auth_method_types.instance_id = projections.users14.instance_id` +
|
||||||
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
|
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
|
||||||
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
|
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
|
||||||
` ON user_idps_count.user_id = projections.users13.id AND user_idps_count.instance_id = projections.users13.instance_id` +
|
` ON user_idps_count.user_id = projections.users14.id AND user_idps_count.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms`
|
` AS OF SYSTEM TIME '-1 ms`
|
||||||
prepareActiveAuthMethodTypesCols = []string{
|
prepareActiveAuthMethodTypesCols = []string{
|
||||||
"password_set",
|
"password_set",
|
||||||
"method_type",
|
"method_type",
|
||||||
"idps_count",
|
"idps_count",
|
||||||
}
|
}
|
||||||
prepareActiveAuthMethodTypesDomainStmt = `SELECT projections.users13_notifications.password_set,` +
|
prepareActiveAuthMethodTypesDomainStmt = `SELECT projections.users14_notifications.password_set,` +
|
||||||
` auth_method_types.method_type,` +
|
` auth_method_types.method_type,` +
|
||||||
` user_idps_count.count` +
|
` user_idps_count.count` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_notifications ON projections.users13.id = projections.users13_notifications.user_id AND projections.users13.instance_id = projections.users13_notifications.instance_id` +
|
` LEFT JOIN projections.users14_notifications ON projections.users14.id = projections.users14_notifications.user_id AND projections.users14.instance_id = projections.users14_notifications.instance_id` +
|
||||||
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods5 AS auth_method_types` +
|
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods5 AS auth_method_types` +
|
||||||
` WHERE auth_method_types.state = $1 AND (auth_method_types.domain IS NULL OR auth_method_types.domain = $2 OR auth_method_types.domain = $3)) AS auth_method_types` +
|
` WHERE auth_method_types.state = $1 AND (auth_method_types.domain IS NULL OR auth_method_types.domain = $2 OR auth_method_types.domain = $3)) AS auth_method_types` +
|
||||||
` ON auth_method_types.user_id = projections.users13.id AND auth_method_types.instance_id = projections.users13.instance_id` +
|
` ON auth_method_types.user_id = projections.users14.id AND auth_method_types.instance_id = projections.users14.instance_id` +
|
||||||
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
|
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
|
||||||
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
|
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
|
||||||
` ON user_idps_count.user_id = projections.users13.id AND user_idps_count.instance_id = projections.users13.instance_id` +
|
` ON user_idps_count.user_id = projections.users14.id AND user_idps_count.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms`
|
` AS OF SYSTEM TIME '-1 ms`
|
||||||
prepareActiveAuthMethodTypesDomainCols = []string{
|
prepareActiveAuthMethodTypesDomainCols = []string{
|
||||||
"password_set",
|
"password_set",
|
||||||
"method_type",
|
"method_type",
|
||||||
"idps_count",
|
"idps_count",
|
||||||
}
|
}
|
||||||
prepareActiveAuthMethodTypesDomainExternalStmt = `SELECT projections.users13_notifications.password_set,` +
|
prepareActiveAuthMethodTypesDomainExternalStmt = `SELECT projections.users14_notifications.password_set,` +
|
||||||
` auth_method_types.method_type,` +
|
` auth_method_types.method_type,` +
|
||||||
` user_idps_count.count` +
|
` user_idps_count.count` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_notifications ON projections.users13.id = projections.users13_notifications.user_id AND projections.users13.instance_id = projections.users13_notifications.instance_id` +
|
` LEFT JOIN projections.users14_notifications ON projections.users14.id = projections.users14_notifications.user_id AND projections.users14.instance_id = projections.users14_notifications.instance_id` +
|
||||||
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods5 AS auth_method_types` +
|
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods5 AS auth_method_types` +
|
||||||
` WHERE auth_method_types.state = $1 AND (auth_method_types.domain IS NULL OR auth_method_types.domain = $2)) AS auth_method_types` +
|
` WHERE auth_method_types.state = $1 AND (auth_method_types.domain IS NULL OR auth_method_types.domain = $2)) AS auth_method_types` +
|
||||||
` ON auth_method_types.user_id = projections.users13.id AND auth_method_types.instance_id = projections.users13.instance_id` +
|
` ON auth_method_types.user_id = projections.users14.id AND auth_method_types.instance_id = projections.users14.instance_id` +
|
||||||
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
|
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
|
||||||
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
|
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
|
||||||
` ON user_idps_count.user_id = projections.users13.id AND user_idps_count.instance_id = projections.users13.instance_id` +
|
` ON user_idps_count.user_id = projections.users14.id AND user_idps_count.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms`
|
` AS OF SYSTEM TIME '-1 ms`
|
||||||
prepareActiveAuthMethodTypesDomainExternalCols = []string{
|
prepareActiveAuthMethodTypesDomainExternalCols = []string{
|
||||||
"password_set",
|
"password_set",
|
||||||
"method_type",
|
"method_type",
|
||||||
"idps_count",
|
"idps_count",
|
||||||
}
|
}
|
||||||
prepareAuthMethodTypesRequiredStmt = `SELECT projections.users13.type,` +
|
prepareAuthMethodTypesRequiredStmt = `SELECT projections.users14.type,` +
|
||||||
` auth_methods_force_mfa.force_mfa,` +
|
` auth_methods_force_mfa.force_mfa,` +
|
||||||
` auth_methods_force_mfa.force_mfa_local_only` +
|
` auth_methods_force_mfa.force_mfa_local_only` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN (SELECT auth_methods_force_mfa.force_mfa, auth_methods_force_mfa.force_mfa_local_only, auth_methods_force_mfa.instance_id, auth_methods_force_mfa.aggregate_id, auth_methods_force_mfa.is_default FROM projections.login_policies5 AS auth_methods_force_mfa) AS auth_methods_force_mfa` +
|
` LEFT JOIN (SELECT auth_methods_force_mfa.force_mfa, auth_methods_force_mfa.force_mfa_local_only, auth_methods_force_mfa.instance_id, auth_methods_force_mfa.aggregate_id, auth_methods_force_mfa.is_default FROM projections.login_policies5 AS auth_methods_force_mfa) AS auth_methods_force_mfa` +
|
||||||
` ON (auth_methods_force_mfa.aggregate_id = projections.users13.instance_id OR auth_methods_force_mfa.aggregate_id = projections.users13.resource_owner) AND auth_methods_force_mfa.instance_id = projections.users13.instance_id` +
|
` ON (auth_methods_force_mfa.aggregate_id = projections.users14.instance_id OR auth_methods_force_mfa.aggregate_id = projections.users14.resource_owner) AND auth_methods_force_mfa.instance_id = projections.users14.instance_id` +
|
||||||
` ORDER BY auth_methods_force_mfa.is_default LIMIT 1
|
` ORDER BY auth_methods_force_mfa.is_default LIMIT 1
|
||||||
`
|
`
|
||||||
prepareAuthMethodTypesRequiredCols = []string{
|
prepareAuthMethodTypesRequiredCols = []string{
|
||||||
|
@ -60,20 +60,21 @@ SELECT
|
|||||||
, h.is_phone_verified
|
, h.is_phone_verified
|
||||||
, h.password_change_required
|
, h.password_change_required
|
||||||
, h.password_changed
|
, h.password_changed
|
||||||
|
, h.mfa_init_skipped
|
||||||
, m.user_id
|
, m.user_id
|
||||||
, m.name
|
, m.name
|
||||||
, m.description
|
, m.description
|
||||||
, m.secret
|
, m.secret
|
||||||
, m.access_token_type
|
, m.access_token_type
|
||||||
, count(*) OVER ()
|
, count(*) OVER ()
|
||||||
FROM projections.users13 u
|
FROM projections.users14 u
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_humans h
|
projections.users14_humans h
|
||||||
ON
|
ON
|
||||||
u.id = h.user_id
|
u.id = h.user_id
|
||||||
AND u.instance_id = h.instance_id
|
AND u.instance_id = h.instance_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_machines m
|
projections.users14_machines m
|
||||||
ON
|
ON
|
||||||
u.id = m.user_id
|
u.id = m.user_id
|
||||||
AND u.instance_id = m.instance_id
|
AND u.instance_id = m.instance_id
|
||||||
|
@ -75,6 +75,7 @@ SELECT
|
|||||||
, h.is_phone_verified
|
, h.is_phone_verified
|
||||||
, h.password_change_required
|
, h.password_change_required
|
||||||
, h.password_changed
|
, h.password_changed
|
||||||
|
, h.mfa_init_skipped
|
||||||
, m.user_id
|
, m.user_id
|
||||||
, m.name
|
, m.name
|
||||||
, m.description
|
, m.description
|
||||||
@ -83,17 +84,17 @@ SELECT
|
|||||||
, count(*) OVER ()
|
, count(*) OVER ()
|
||||||
FROM found_users fu
|
FROM found_users fu
|
||||||
JOIN
|
JOIN
|
||||||
projections.users13 u
|
projections.users14 u
|
||||||
ON
|
ON
|
||||||
fu.id = u.id
|
fu.id = u.id
|
||||||
AND fu.instance_id = u.instance_id
|
AND fu.instance_id = u.instance_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_humans h
|
projections.users14_humans h
|
||||||
ON
|
ON
|
||||||
fu.id = h.user_id
|
fu.id = h.user_id
|
||||||
AND fu.instance_id = h.instance_id
|
AND fu.instance_id = h.instance_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_machines m
|
projections.users14_machines m
|
||||||
ON
|
ON
|
||||||
fu.id = m.user_id
|
fu.id = m.user_id
|
||||||
AND fu.instance_id = m.instance_id
|
AND fu.instance_id = m.instance_id
|
||||||
|
@ -23,14 +23,14 @@ var (
|
|||||||
", projections.user_grants5.roles" +
|
", projections.user_grants5.roles" +
|
||||||
", projections.user_grants5.state" +
|
", projections.user_grants5.state" +
|
||||||
", projections.user_grants5.user_id" +
|
", projections.user_grants5.user_id" +
|
||||||
", projections.users13.username" +
|
", projections.users14.username" +
|
||||||
", projections.users13.type" +
|
", projections.users14.type" +
|
||||||
", projections.users13.resource_owner" +
|
", projections.users14.resource_owner" +
|
||||||
", projections.users13_humans.first_name" +
|
", projections.users14_humans.first_name" +
|
||||||
", projections.users13_humans.last_name" +
|
", projections.users14_humans.last_name" +
|
||||||
", projections.users13_humans.email" +
|
", projections.users14_humans.email" +
|
||||||
", projections.users13_humans.display_name" +
|
", projections.users14_humans.display_name" +
|
||||||
", projections.users13_humans.avatar_key" +
|
", projections.users14_humans.avatar_key" +
|
||||||
", projections.login_names3.login_name" +
|
", projections.login_names3.login_name" +
|
||||||
", projections.user_grants5.resource_owner" +
|
", projections.user_grants5.resource_owner" +
|
||||||
", projections.orgs1.name" +
|
", projections.orgs1.name" +
|
||||||
@ -41,11 +41,11 @@ var (
|
|||||||
", granted_orgs.name" +
|
", granted_orgs.name" +
|
||||||
", granted_orgs.primary_domain" +
|
", granted_orgs.primary_domain" +
|
||||||
" FROM projections.user_grants5" +
|
" FROM projections.user_grants5" +
|
||||||
" LEFT JOIN projections.users13 ON projections.user_grants5.user_id = projections.users13.id AND projections.user_grants5.instance_id = projections.users13.instance_id" +
|
" LEFT JOIN projections.users14 ON projections.user_grants5.user_id = projections.users14.id AND projections.user_grants5.instance_id = projections.users14.instance_id" +
|
||||||
" LEFT JOIN projections.users13_humans ON projections.user_grants5.user_id = projections.users13_humans.user_id AND projections.user_grants5.instance_id = projections.users13_humans.instance_id" +
|
" LEFT JOIN projections.users14_humans ON projections.user_grants5.user_id = projections.users14_humans.user_id AND projections.user_grants5.instance_id = projections.users14_humans.instance_id" +
|
||||||
" LEFT JOIN projections.orgs1 ON projections.user_grants5.resource_owner = projections.orgs1.id AND projections.user_grants5.instance_id = projections.orgs1.instance_id" +
|
" LEFT JOIN projections.orgs1 ON projections.user_grants5.resource_owner = projections.orgs1.id AND projections.user_grants5.instance_id = projections.orgs1.instance_id" +
|
||||||
" LEFT JOIN projections.projects4 ON projections.user_grants5.project_id = projections.projects4.id AND projections.user_grants5.instance_id = projections.projects4.instance_id" +
|
" LEFT JOIN projections.projects4 ON projections.user_grants5.project_id = projections.projects4.id AND projections.user_grants5.instance_id = projections.projects4.instance_id" +
|
||||||
" LEFT JOIN projections.orgs1 AS granted_orgs ON projections.users13.resource_owner = granted_orgs.id AND projections.users13.instance_id = granted_orgs.instance_id" +
|
" LEFT JOIN projections.orgs1 AS granted_orgs ON projections.users14.resource_owner = granted_orgs.id AND projections.users14.instance_id = granted_orgs.instance_id" +
|
||||||
" LEFT JOIN projections.login_names3 ON projections.user_grants5.user_id = projections.login_names3.user_id AND projections.user_grants5.instance_id = projections.login_names3.instance_id" +
|
" LEFT JOIN projections.login_names3 ON projections.user_grants5.user_id = projections.login_names3.user_id AND projections.user_grants5.instance_id = projections.login_names3.instance_id" +
|
||||||
` AS OF SYSTEM TIME '-1 ms' ` +
|
` AS OF SYSTEM TIME '-1 ms' ` +
|
||||||
" WHERE projections.login_names3.is_primary = $1")
|
" WHERE projections.login_names3.is_primary = $1")
|
||||||
@ -85,14 +85,14 @@ var (
|
|||||||
", projections.user_grants5.roles" +
|
", projections.user_grants5.roles" +
|
||||||
", projections.user_grants5.state" +
|
", projections.user_grants5.state" +
|
||||||
", projections.user_grants5.user_id" +
|
", projections.user_grants5.user_id" +
|
||||||
", projections.users13.username" +
|
", projections.users14.username" +
|
||||||
", projections.users13.type" +
|
", projections.users14.type" +
|
||||||
", projections.users13.resource_owner" +
|
", projections.users14.resource_owner" +
|
||||||
", projections.users13_humans.first_name" +
|
", projections.users14_humans.first_name" +
|
||||||
", projections.users13_humans.last_name" +
|
", projections.users14_humans.last_name" +
|
||||||
", projections.users13_humans.email" +
|
", projections.users14_humans.email" +
|
||||||
", projections.users13_humans.display_name" +
|
", projections.users14_humans.display_name" +
|
||||||
", projections.users13_humans.avatar_key" +
|
", projections.users14_humans.avatar_key" +
|
||||||
", projections.login_names3.login_name" +
|
", projections.login_names3.login_name" +
|
||||||
", projections.user_grants5.resource_owner" +
|
", projections.user_grants5.resource_owner" +
|
||||||
", projections.orgs1.name" +
|
", projections.orgs1.name" +
|
||||||
@ -104,11 +104,11 @@ var (
|
|||||||
", granted_orgs.primary_domain" +
|
", granted_orgs.primary_domain" +
|
||||||
", COUNT(*) OVER ()" +
|
", COUNT(*) OVER ()" +
|
||||||
" FROM projections.user_grants5" +
|
" FROM projections.user_grants5" +
|
||||||
" LEFT JOIN projections.users13 ON projections.user_grants5.user_id = projections.users13.id AND projections.user_grants5.instance_id = projections.users13.instance_id" +
|
" LEFT JOIN projections.users14 ON projections.user_grants5.user_id = projections.users14.id AND projections.user_grants5.instance_id = projections.users14.instance_id" +
|
||||||
" LEFT JOIN projections.users13_humans ON projections.user_grants5.user_id = projections.users13_humans.user_id AND projections.user_grants5.instance_id = projections.users13_humans.instance_id" +
|
" LEFT JOIN projections.users14_humans ON projections.user_grants5.user_id = projections.users14_humans.user_id AND projections.user_grants5.instance_id = projections.users14_humans.instance_id" +
|
||||||
" LEFT JOIN projections.orgs1 ON projections.user_grants5.resource_owner = projections.orgs1.id AND projections.user_grants5.instance_id = projections.orgs1.instance_id" +
|
" LEFT JOIN projections.orgs1 ON projections.user_grants5.resource_owner = projections.orgs1.id AND projections.user_grants5.instance_id = projections.orgs1.instance_id" +
|
||||||
" LEFT JOIN projections.projects4 ON projections.user_grants5.project_id = projections.projects4.id AND projections.user_grants5.instance_id = projections.projects4.instance_id" +
|
" LEFT JOIN projections.projects4 ON projections.user_grants5.project_id = projections.projects4.id AND projections.user_grants5.instance_id = projections.projects4.instance_id" +
|
||||||
" LEFT JOIN projections.orgs1 AS granted_orgs ON projections.users13.resource_owner = granted_orgs.id AND projections.users13.instance_id = granted_orgs.instance_id" +
|
" LEFT JOIN projections.orgs1 AS granted_orgs ON projections.users14.resource_owner = granted_orgs.id AND projections.users14.instance_id = granted_orgs.instance_id" +
|
||||||
" LEFT JOIN projections.login_names3 ON projections.user_grants5.user_id = projections.login_names3.user_id AND projections.user_grants5.instance_id = projections.login_names3.instance_id" +
|
" LEFT JOIN projections.login_names3 ON projections.user_grants5.user_id = projections.login_names3.user_id AND projections.user_grants5.instance_id = projections.login_names3.instance_id" +
|
||||||
` AS OF SYSTEM TIME '-1 ms' ` +
|
` AS OF SYSTEM TIME '-1 ms' ` +
|
||||||
" WHERE projections.login_names3.is_primary = $1")
|
" WHERE projections.login_names3.is_primary = $1")
|
||||||
|
@ -62,14 +62,14 @@ SELECT
|
|||||||
, n.verified_phone
|
, n.verified_phone
|
||||||
, n.password_set
|
, n.password_set
|
||||||
, count(*) OVER ()
|
, count(*) OVER ()
|
||||||
FROM projections.users13 u
|
FROM projections.users14 u
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_humans h
|
projections.users14_humans h
|
||||||
ON
|
ON
|
||||||
u.id = h.user_id
|
u.id = h.user_id
|
||||||
AND u.instance_id = h.instance_id
|
AND u.instance_id = h.instance_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_notifications n
|
projections.users14_notifications n
|
||||||
ON
|
ON
|
||||||
u.id = n.user_id
|
u.id = n.user_id
|
||||||
AND u.instance_id = n.instance_id
|
AND u.instance_id = n.instance_id
|
||||||
|
@ -78,17 +78,17 @@ SELECT
|
|||||||
, count(*) OVER ()
|
, count(*) OVER ()
|
||||||
FROM found_users fu
|
FROM found_users fu
|
||||||
JOIN
|
JOIN
|
||||||
projections.users13 u
|
projections.users14 u
|
||||||
ON
|
ON
|
||||||
fu.id = u.id
|
fu.id = u.id
|
||||||
AND fu.instance_id = u.instance_id
|
AND fu.instance_id = u.instance_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_humans h
|
projections.users14_humans h
|
||||||
ON
|
ON
|
||||||
fu.id = h.user_id
|
fu.id = h.user_id
|
||||||
AND fu.instance_id = h.instance_id
|
AND fu.instance_id = h.instance_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
projections.users13_notifications n
|
projections.users14_notifications n
|
||||||
ON
|
ON
|
||||||
fu.id = n.user_id
|
fu.id = n.user_id
|
||||||
AND fu.instance_id = n.instance_id
|
AND fu.instance_id = n.instance_id
|
||||||
|
@ -229,45 +229,46 @@ var (
|
|||||||
preferredLoginNameQuery = `SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id` +
|
preferredLoginNameQuery = `SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id` +
|
||||||
` FROM projections.login_names3 AS preferred_login_name` +
|
` FROM projections.login_names3 AS preferred_login_name` +
|
||||||
` WHERE preferred_login_name.is_primary = $1`
|
` WHERE preferred_login_name.is_primary = $1`
|
||||||
userQuery = `SELECT projections.users13.id,` +
|
userQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.creation_date,` +
|
` projections.users14.creation_date,` +
|
||||||
` projections.users13.change_date,` +
|
` projections.users14.change_date,` +
|
||||||
` projections.users13.resource_owner,` +
|
` projections.users14.resource_owner,` +
|
||||||
` projections.users13.sequence,` +
|
` projections.users14.sequence,` +
|
||||||
` projections.users13.state,` +
|
` projections.users14.state,` +
|
||||||
` projections.users13.type,` +
|
` projections.users14.type,` +
|
||||||
` projections.users13.username,` +
|
` projections.users14.username,` +
|
||||||
` login_names.loginnames,` +
|
` login_names.loginnames,` +
|
||||||
` preferred_login_name.login_name,` +
|
` preferred_login_name.login_name,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.first_name,` +
|
` projections.users14_humans.first_name,` +
|
||||||
` projections.users13_humans.last_name,` +
|
` projections.users14_humans.last_name,` +
|
||||||
` projections.users13_humans.nick_name,` +
|
` projections.users14_humans.nick_name,` +
|
||||||
` projections.users13_humans.display_name,` +
|
` projections.users14_humans.display_name,` +
|
||||||
` projections.users13_humans.preferred_language,` +
|
` projections.users14_humans.preferred_language,` +
|
||||||
` projections.users13_humans.gender,` +
|
` projections.users14_humans.gender,` +
|
||||||
` projections.users13_humans.avatar_key,` +
|
` projections.users14_humans.avatar_key,` +
|
||||||
` projections.users13_humans.email,` +
|
` projections.users14_humans.email,` +
|
||||||
` projections.users13_humans.is_email_verified,` +
|
` projections.users14_humans.is_email_verified,` +
|
||||||
` projections.users13_humans.phone,` +
|
` projections.users14_humans.phone,` +
|
||||||
` projections.users13_humans.is_phone_verified,` +
|
` projections.users14_humans.is_phone_verified,` +
|
||||||
` projections.users13_humans.password_change_required,` +
|
` projections.users14_humans.password_change_required,` +
|
||||||
` projections.users13_humans.password_changed,` +
|
` projections.users14_humans.password_changed,` +
|
||||||
` projections.users13_machines.user_id,` +
|
` projections.users14_humans.mfa_init_skipped,` +
|
||||||
` projections.users13_machines.name,` +
|
` projections.users14_machines.user_id,` +
|
||||||
` projections.users13_machines.description,` +
|
` projections.users14_machines.name,` +
|
||||||
` projections.users13_machines.secret,` +
|
` projections.users14_machines.description,` +
|
||||||
` projections.users13_machines.access_token_type,` +
|
` projections.users14_machines.secret,` +
|
||||||
|
` projections.users14_machines.access_token_type,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users13_machines ON projections.users13.id = projections.users13_machines.user_id AND projections.users13.instance_id = projections.users13_machines.instance_id` +
|
` LEFT JOIN projections.users14_machines ON projections.users14.id = projections.users14_machines.user_id AND projections.users14.instance_id = projections.users14_machines.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (` + loginNamesQuery + `) AS login_names` +
|
` (` + loginNamesQuery + `) AS login_names` +
|
||||||
` ON login_names.user_id = projections.users13.id AND login_names.instance_id = projections.users13.instance_id` +
|
` ON login_names.user_id = projections.users14.id AND login_names.instance_id = projections.users14.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
|
` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
|
||||||
` ON preferred_login_name.user_id = projections.users13.id AND preferred_login_name.instance_id = projections.users13.instance_id` +
|
` ON preferred_login_name.user_id = projections.users14.id AND preferred_login_name.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
userCols = []string{
|
userCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -295,6 +296,7 @@ var (
|
|||||||
"is_phone_verified",
|
"is_phone_verified",
|
||||||
"password_change_required",
|
"password_change_required",
|
||||||
"password_changed",
|
"password_changed",
|
||||||
|
"mfa_init_skipped",
|
||||||
// machine
|
// machine
|
||||||
"user_id",
|
"user_id",
|
||||||
"name",
|
"name",
|
||||||
@ -303,21 +305,21 @@ var (
|
|||||||
"access_token_type",
|
"access_token_type",
|
||||||
"count",
|
"count",
|
||||||
}
|
}
|
||||||
profileQuery = `SELECT projections.users13.id,` +
|
profileQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.creation_date,` +
|
` projections.users14.creation_date,` +
|
||||||
` projections.users13.change_date,` +
|
` projections.users14.change_date,` +
|
||||||
` projections.users13.resource_owner,` +
|
` projections.users14.resource_owner,` +
|
||||||
` projections.users13.sequence,` +
|
` projections.users14.sequence,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.first_name,` +
|
` projections.users14_humans.first_name,` +
|
||||||
` projections.users13_humans.last_name,` +
|
` projections.users14_humans.last_name,` +
|
||||||
` projections.users13_humans.nick_name,` +
|
` projections.users14_humans.nick_name,` +
|
||||||
` projections.users13_humans.display_name,` +
|
` projections.users14_humans.display_name,` +
|
||||||
` projections.users13_humans.preferred_language,` +
|
` projections.users14_humans.preferred_language,` +
|
||||||
` projections.users13_humans.gender,` +
|
` projections.users14_humans.gender,` +
|
||||||
` projections.users13_humans.avatar_key` +
|
` projections.users14_humans.avatar_key` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
profileCols = []string{
|
profileCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -334,16 +336,16 @@ var (
|
|||||||
"gender",
|
"gender",
|
||||||
"avatar_key",
|
"avatar_key",
|
||||||
}
|
}
|
||||||
emailQuery = `SELECT projections.users13.id,` +
|
emailQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.creation_date,` +
|
` projections.users14.creation_date,` +
|
||||||
` projections.users13.change_date,` +
|
` projections.users14.change_date,` +
|
||||||
` projections.users13.resource_owner,` +
|
` projections.users14.resource_owner,` +
|
||||||
` projections.users13.sequence,` +
|
` projections.users14.sequence,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.email,` +
|
` projections.users14_humans.email,` +
|
||||||
` projections.users13_humans.is_email_verified` +
|
` projections.users14_humans.is_email_verified` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
emailCols = []string{
|
emailCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -355,16 +357,16 @@ var (
|
|||||||
"email",
|
"email",
|
||||||
"is_email_verified",
|
"is_email_verified",
|
||||||
}
|
}
|
||||||
phoneQuery = `SELECT projections.users13.id,` +
|
phoneQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.creation_date,` +
|
` projections.users14.creation_date,` +
|
||||||
` projections.users13.change_date,` +
|
` projections.users14.change_date,` +
|
||||||
` projections.users13.resource_owner,` +
|
` projections.users14.resource_owner,` +
|
||||||
` projections.users13.sequence,` +
|
` projections.users14.sequence,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.phone,` +
|
` projections.users14_humans.phone,` +
|
||||||
` projections.users13_humans.is_phone_verified` +
|
` projections.users14_humans.is_phone_verified` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
phoneCols = []string{
|
phoneCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -376,14 +378,14 @@ var (
|
|||||||
"phone",
|
"phone",
|
||||||
"is_phone_verified",
|
"is_phone_verified",
|
||||||
}
|
}
|
||||||
userUniqueQuery = `SELECT projections.users13.id,` +
|
userUniqueQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.state,` +
|
` projections.users14.state,` +
|
||||||
` projections.users13.username,` +
|
` projections.users14.username,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.email,` +
|
` projections.users14_humans.email,` +
|
||||||
` projections.users13_humans.is_email_verified` +
|
` projections.users14_humans.is_email_verified` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
userUniqueCols = []string{
|
userUniqueCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -393,40 +395,40 @@ var (
|
|||||||
"email",
|
"email",
|
||||||
"is_email_verified",
|
"is_email_verified",
|
||||||
}
|
}
|
||||||
notifyUserQuery = `SELECT projections.users13.id,` +
|
notifyUserQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.creation_date,` +
|
` projections.users14.creation_date,` +
|
||||||
` projections.users13.change_date,` +
|
` projections.users14.change_date,` +
|
||||||
` projections.users13.resource_owner,` +
|
` projections.users14.resource_owner,` +
|
||||||
` projections.users13.sequence,` +
|
` projections.users14.sequence,` +
|
||||||
` projections.users13.state,` +
|
` projections.users14.state,` +
|
||||||
` projections.users13.type,` +
|
` projections.users14.type,` +
|
||||||
` projections.users13.username,` +
|
` projections.users14.username,` +
|
||||||
` login_names.loginnames,` +
|
` login_names.loginnames,` +
|
||||||
` preferred_login_name.login_name,` +
|
` preferred_login_name.login_name,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.first_name,` +
|
` projections.users14_humans.first_name,` +
|
||||||
` projections.users13_humans.last_name,` +
|
` projections.users14_humans.last_name,` +
|
||||||
` projections.users13_humans.nick_name,` +
|
` projections.users14_humans.nick_name,` +
|
||||||
` projections.users13_humans.display_name,` +
|
` projections.users14_humans.display_name,` +
|
||||||
` projections.users13_humans.preferred_language,` +
|
` projections.users14_humans.preferred_language,` +
|
||||||
` projections.users13_humans.gender,` +
|
` projections.users14_humans.gender,` +
|
||||||
` projections.users13_humans.avatar_key,` +
|
` projections.users14_humans.avatar_key,` +
|
||||||
` projections.users13_notifications.user_id,` +
|
` projections.users14_notifications.user_id,` +
|
||||||
` projections.users13_notifications.last_email,` +
|
` projections.users14_notifications.last_email,` +
|
||||||
` projections.users13_notifications.verified_email,` +
|
` projections.users14_notifications.verified_email,` +
|
||||||
` projections.users13_notifications.last_phone,` +
|
` projections.users14_notifications.last_phone,` +
|
||||||
` projections.users13_notifications.verified_phone,` +
|
` projections.users14_notifications.verified_phone,` +
|
||||||
` projections.users13_notifications.password_set,` +
|
` projections.users14_notifications.password_set,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users13_notifications ON projections.users13.id = projections.users13_notifications.user_id AND projections.users13.instance_id = projections.users13_notifications.instance_id` +
|
` LEFT JOIN projections.users14_notifications ON projections.users14.id = projections.users14_notifications.user_id AND projections.users14.instance_id = projections.users14_notifications.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (` + loginNamesQuery + `) AS login_names` +
|
` (` + loginNamesQuery + `) AS login_names` +
|
||||||
` ON login_names.user_id = projections.users13.id AND login_names.instance_id = projections.users13.instance_id` +
|
` ON login_names.user_id = projections.users14.id AND login_names.instance_id = projections.users14.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
|
` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
|
||||||
` ON preferred_login_name.user_id = projections.users13.id AND preferred_login_name.instance_id = projections.users13.instance_id` +
|
` ON preferred_login_name.user_id = projections.users14.id AND preferred_login_name.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
notifyUserCols = []string{
|
notifyUserCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -457,45 +459,45 @@ var (
|
|||||||
"password_set",
|
"password_set",
|
||||||
"count",
|
"count",
|
||||||
}
|
}
|
||||||
usersQuery = `SELECT projections.users13.id,` +
|
usersQuery = `SELECT projections.users14.id,` +
|
||||||
` projections.users13.creation_date,` +
|
` projections.users14.creation_date,` +
|
||||||
` projections.users13.change_date,` +
|
` projections.users14.change_date,` +
|
||||||
` projections.users13.resource_owner,` +
|
` projections.users14.resource_owner,` +
|
||||||
` projections.users13.sequence,` +
|
` projections.users14.sequence,` +
|
||||||
` projections.users13.state,` +
|
` projections.users14.state,` +
|
||||||
` projections.users13.type,` +
|
` projections.users14.type,` +
|
||||||
` projections.users13.username,` +
|
` projections.users14.username,` +
|
||||||
` login_names.loginnames,` +
|
` login_names.loginnames,` +
|
||||||
` preferred_login_name.login_name,` +
|
` preferred_login_name.login_name,` +
|
||||||
` projections.users13_humans.user_id,` +
|
` projections.users14_humans.user_id,` +
|
||||||
` projections.users13_humans.first_name,` +
|
` projections.users14_humans.first_name,` +
|
||||||
` projections.users13_humans.last_name,` +
|
` projections.users14_humans.last_name,` +
|
||||||
` projections.users13_humans.nick_name,` +
|
` projections.users14_humans.nick_name,` +
|
||||||
` projections.users13_humans.display_name,` +
|
` projections.users14_humans.display_name,` +
|
||||||
` projections.users13_humans.preferred_language,` +
|
` projections.users14_humans.preferred_language,` +
|
||||||
` projections.users13_humans.gender,` +
|
` projections.users14_humans.gender,` +
|
||||||
` projections.users13_humans.avatar_key,` +
|
` projections.users14_humans.avatar_key,` +
|
||||||
` projections.users13_humans.email,` +
|
` projections.users14_humans.email,` +
|
||||||
` projections.users13_humans.is_email_verified,` +
|
` projections.users14_humans.is_email_verified,` +
|
||||||
` projections.users13_humans.phone,` +
|
` projections.users14_humans.phone,` +
|
||||||
` projections.users13_humans.is_phone_verified,` +
|
` projections.users14_humans.is_phone_verified,` +
|
||||||
` projections.users13_humans.password_change_required,` +
|
` projections.users14_humans.password_change_required,` +
|
||||||
` projections.users13_humans.password_changed,` +
|
` projections.users14_humans.password_changed,` +
|
||||||
` projections.users13_machines.user_id,` +
|
` projections.users14_machines.user_id,` +
|
||||||
` projections.users13_machines.name,` +
|
` projections.users14_machines.name,` +
|
||||||
` projections.users13_machines.description,` +
|
` projections.users14_machines.description,` +
|
||||||
` projections.users13_machines.secret,` +
|
` projections.users14_machines.secret,` +
|
||||||
` projections.users13_machines.access_token_type,` +
|
` projections.users14_machines.access_token_type,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.users13` +
|
` FROM projections.users14` +
|
||||||
` LEFT JOIN projections.users13_humans ON projections.users13.id = projections.users13_humans.user_id AND projections.users13.instance_id = projections.users13_humans.instance_id` +
|
` LEFT JOIN projections.users14_humans ON projections.users14.id = projections.users14_humans.user_id AND projections.users14.instance_id = projections.users14_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users13_machines ON projections.users13.id = projections.users13_machines.user_id AND projections.users13.instance_id = projections.users13_machines.instance_id` +
|
` LEFT JOIN projections.users14_machines ON projections.users14.id = projections.users14_machines.user_id AND projections.users14.instance_id = projections.users14_machines.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (` + loginNamesQuery + `) AS login_names` +
|
` (` + loginNamesQuery + `) AS login_names` +
|
||||||
` ON login_names.user_id = projections.users13.id AND login_names.instance_id = projections.users13.instance_id` +
|
` ON login_names.user_id = projections.users14.id AND login_names.instance_id = projections.users14.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
|
` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
|
||||||
` ON preferred_login_name.user_id = projections.users13.id AND preferred_login_name.instance_id = projections.users13.instance_id` +
|
` ON preferred_login_name.user_id = projections.users14.id AND preferred_login_name.instance_id = projections.users14.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`
|
` AS OF SYSTEM TIME '-1 ms'`
|
||||||
usersCols = []string{
|
usersCols = []string{
|
||||||
"id",
|
"id",
|
||||||
@ -531,7 +533,7 @@ var (
|
|||||||
"access_token_type",
|
"access_token_type",
|
||||||
"count",
|
"count",
|
||||||
}
|
}
|
||||||
countUsersQuery = "SELECT COUNT(*) OVER () FROM projections.users13"
|
countUsersQuery = "SELECT COUNT(*) OVER () FROM projections.users14"
|
||||||
countUsersCols = []string{"count"}
|
countUsersCols = []string{"count"}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -597,6 +599,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
testNow,
|
testNow,
|
||||||
|
testNow,
|
||||||
// machine
|
// machine
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
@ -632,6 +635,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
IsPhoneVerified: true,
|
IsPhoneVerified: true,
|
||||||
PasswordChangeRequired: true,
|
PasswordChangeRequired: true,
|
||||||
PasswordChanged: testNow,
|
PasswordChanged: testNow,
|
||||||
|
MFAInitSkipped: testNow,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -668,6 +672,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
// machine
|
// machine
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
@ -730,6 +735,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
nil,
|
||||||
// machine
|
// machine
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
with usr as (
|
with usr as (
|
||||||
select u.id, u.creation_date, u.change_date, u.sequence, u.state, u.resource_owner, u.username, n.login_name as preferred_login_name
|
select u.id, u.creation_date, u.change_date, u.sequence, u.state, u.resource_owner, u.username, n.login_name as preferred_login_name
|
||||||
from projections.users13 u
|
from projections.users14 u
|
||||||
left join projections.login_names3 n on u.id = n.user_id and u.instance_id = n.instance_id
|
left join projections.login_names3 n on u.id = n.user_id and u.instance_id = n.instance_id
|
||||||
where u.id = $1 and u.state = 1 -- only allow active users
|
where u.id = $1 and u.state = 1 -- only allow active users
|
||||||
and u.instance_id = $2
|
and u.instance_id = $2
|
||||||
@ -9,7 +9,7 @@ with usr as (
|
|||||||
human as (
|
human as (
|
||||||
select $1 as user_id, row_to_json(r) as human from (
|
select $1 as user_id, row_to_json(r) as human from (
|
||||||
select first_name, last_name, nick_name, display_name, avatar_key, preferred_language, gender, email, is_email_verified, phone, is_phone_verified
|
select first_name, last_name, nick_name, display_name, avatar_key, preferred_language, gender, email, is_email_verified, phone, is_phone_verified
|
||||||
from projections.users13_humans
|
from projections.users14_humans
|
||||||
where user_id = $1
|
where user_id = $1
|
||||||
and instance_id = $2
|
and instance_id = $2
|
||||||
) r
|
) r
|
||||||
@ -17,7 +17,7 @@ human as (
|
|||||||
machine as (
|
machine as (
|
||||||
select $1 as user_id, row_to_json(r) as machine from (
|
select $1 as user_id, row_to_json(r) as machine from (
|
||||||
select name, description
|
select name, description
|
||||||
from projections.users13_machines
|
from projections.users14_machines
|
||||||
where user_id = $1
|
where user_id = $1
|
||||||
and instance_id = $2
|
and instance_id = $2
|
||||||
) r
|
) r
|
||||||
|
@ -103,9 +103,10 @@ func NewHumanOTPVerifiedEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HumanOTPVerifiedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
func HumanOTPVerifiedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||||
return &HumanOTPVerifiedEvent{
|
out := &HumanOTPVerifiedEvent{
|
||||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||||
}, nil
|
}
|
||||||
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type HumanOTPRemovedEvent struct {
|
type HumanOTPRemovedEvent struct {
|
||||||
|
@ -74,18 +74,18 @@ SELECT
|
|||||||
, u.instance_id
|
, u.instance_id
|
||||||
, (SELECT EXISTS (SELECT true FROM verified_auth_methods WHERE method_type = 6)) AS otp_sms_added
|
, (SELECT EXISTS (SELECT true FROM verified_auth_methods WHERE method_type = 6)) AS otp_sms_added
|
||||||
, (SELECT EXISTS (SELECT true FROM verified_auth_methods WHERE method_type = 7)) AS otp_email_added
|
, (SELECT EXISTS (SELECT true FROM verified_auth_methods WHERE method_type = 7)) AS otp_email_added
|
||||||
FROM projections.users13 u
|
FROM projections.users14 u
|
||||||
LEFT JOIN projections.users13_humans h
|
LEFT JOIN projections.users14_humans h
|
||||||
ON u.instance_id = h.instance_id
|
ON u.instance_id = h.instance_id
|
||||||
AND u.id = h.user_id
|
AND u.id = h.user_id
|
||||||
LEFT JOIN projections.users13_notifications n
|
LEFT JOIN projections.users14_notifications n
|
||||||
ON u.instance_id = n.instance_id
|
ON u.instance_id = n.instance_id
|
||||||
AND u.id = n.user_id
|
AND u.id = n.user_id
|
||||||
LEFT JOIN projections.login_names3 l
|
LEFT JOIN projections.login_names3 l
|
||||||
ON u.instance_id = l.instance_id
|
ON u.instance_id = l.instance_id
|
||||||
AND u.id = l.user_id
|
AND u.id = l.user_id
|
||||||
AND l.is_primary = true
|
AND l.is_primary = true
|
||||||
LEFT JOIN projections.users13_machines m
|
LEFT JOIN projections.users14_machines m
|
||||||
ON u.instance_id = m.instance_id
|
ON u.instance_id = m.instance_id
|
||||||
AND u.id = m.user_id
|
AND u.id = m.user_id
|
||||||
LEFT JOIN auth.users3 au
|
LEFT JOIN auth.users3 au
|
||||||
|
@ -20,8 +20,8 @@ SELECT s.creation_date,
|
|||||||
s.instance_id,
|
s.instance_id,
|
||||||
s.id
|
s.id
|
||||||
FROM auth.user_sessions s
|
FROM auth.user_sessions s
|
||||||
LEFT JOIN projections.users13 u ON s.user_id = u.id AND s.instance_id = u.instance_id
|
LEFT JOIN projections.users14 u ON s.user_id = u.id AND s.instance_id = u.instance_id
|
||||||
LEFT JOIN projections.users13_humans h ON s.user_id = h.user_id AND s.instance_id = h.instance_id
|
LEFT JOIN projections.users14_humans h ON s.user_id = h.user_id AND s.instance_id = h.instance_id
|
||||||
LEFT JOIN projections.login_names3 l ON s.user_id = l.user_id AND s.instance_id = l.instance_id AND l.is_primary = true
|
LEFT JOIN projections.login_names3 l ON s.user_id = l.user_id AND s.instance_id = l.instance_id AND l.is_primary = true
|
||||||
WHERE (s.user_agent_id = $1)
|
WHERE (s.user_agent_id = $1)
|
||||||
AND (s.user_id = $2)
|
AND (s.user_id = $2)
|
||||||
|
@ -20,8 +20,8 @@ SELECT s.creation_date,
|
|||||||
s.instance_id,
|
s.instance_id,
|
||||||
s.id
|
s.id
|
||||||
FROM auth.user_sessions s
|
FROM auth.user_sessions s
|
||||||
LEFT JOIN projections.users13 u ON s.user_id = u.id AND s.instance_id = u.instance_id
|
LEFT JOIN projections.users14 u ON s.user_id = u.id AND s.instance_id = u.instance_id
|
||||||
LEFT JOIN projections.users13_humans h ON s.user_id = h.user_id AND s.instance_id = h.instance_id
|
LEFT JOIN projections.users14_humans h ON s.user_id = h.user_id AND s.instance_id = h.instance_id
|
||||||
LEFT JOIN projections.login_names3 l ON s.user_id = l.user_id AND s.instance_id = l.instance_id AND l.is_primary = true
|
LEFT JOIN projections.login_names3 l ON s.user_id = l.user_id AND s.instance_id = l.instance_id AND l.is_primary = true
|
||||||
WHERE (s.user_agent_id = $1 and s.user_agent_id <> '')
|
WHERE (s.user_agent_id = $1 and s.user_agent_id <> '')
|
||||||
AND (s.instance_id = $2)
|
AND (s.instance_id = $2)
|
||||||
|
@ -175,6 +175,8 @@ message HumanUser {
|
|||||||
bool password_change_required = 9;
|
bool password_change_required = 9;
|
||||||
// The time the user last changed their password.
|
// The time the user last changed their password.
|
||||||
google.protobuf.Timestamp password_changed = 10;
|
google.protobuf.Timestamp password_changed = 10;
|
||||||
|
// The time the user last skipped MFA initialization.
|
||||||
|
google.protobuf.Timestamp mfa_init_skipped = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
message User {
|
message User {
|
||||||
|
@ -1206,6 +1206,32 @@ service UserService {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MFA Init Skipped
|
||||||
|
//
|
||||||
|
// Update the last time the user has skipped MFA initialization. The server timestamp is used.
|
||||||
|
rpc HumanMFAInitSkipped(HumanMFAInitSkippedRequest) returns (HumanMFAInitSkippedResponse) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/v2/users/{user_id}/mfa_init_skipped"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
|
||||||
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
||||||
|
auth_option: {
|
||||||
|
permission: "authenticated"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
responses: {
|
||||||
|
key: "200"
|
||||||
|
value: {
|
||||||
|
description: "OK";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddHumanUserRequest{
|
message AddHumanUserRequest{
|
||||||
@ -2336,3 +2362,19 @@ message VerifyInviteCodeRequest {
|
|||||||
message VerifyInviteCodeResponse {
|
message VerifyInviteCodeResponse {
|
||||||
zitadel.object.v2.Details details = 1;
|
zitadel.object.v2.Details details = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message HumanMFAInitSkippedRequest {
|
||||||
|
string user_id = 1 [
|
||||||
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||||
|
(google.api.field_behavior) = REQUIRED,
|
||||||
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||||
|
min_length: 1;
|
||||||
|
max_length: 200;
|
||||||
|
example: "\"69629012906488334\"";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
message HumanMFAInitSkippedResponse {
|
||||||
|
zitadel.object.v2.Details details = 1;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user