MSP-6148 add idle logout
This commit is contained in:
1 parent
841c75b457
commit
494ffac97c
5 files changed
+81
-6
No files matched your search
+6
-1
@@ -213,7 +213,7 @@ func (a Auth) LoginWithSudir(ctx context.Context, request domain.LoginSudirReque
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a Auth) Logout(ctx context.Context, adminId int64) error {
|
||||
func (a Auth) Logout(ctx context.Context, adminId int64, request *domain.LogoutRequest) error {
|
||||
err := a.txRunner.AuthTransaction(ctx, func(ctx context.Context, tx AuthTransaction) error {
|
||||
err := a.tokenService.RevokeAllByUserId(ctx, adminId)
|
||||
if err != nil {
|
||||
@@ -226,6 +226,11 @@ func (a Auth) Logout(ctx context.Context, adminId int64) error {
|
||||
return errors.WithMessage(err, "update user last_active_at")
|
||||
}
|
||||
|
||||
if request != nil && request.Reason == "idle" {
|
||||
a.auditService.SaveAuditAsync(ctx, adminId, "Выход по бездействию", entity.EventSuccessLogout)
|
||||
return nil
|
||||
}
|
||||
|
||||
a.auditService.SaveAuditAsync(ctx, adminId, "Выход", entity.EventSuccessLogout)
|
||||
return nil
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user