()
| 297 | } |
| 298 | |
| 299 | func (s *Service) runtimeAuthSyncHook() coreauth.PostAuthHook { |
| 300 | return func(ctx context.Context, auth *coreauth.Auth) error { |
| 301 | if s == nil || auth == nil || auth.ID == "" { |
| 302 | return nil |
| 303 | } |
| 304 | action := watcher.AuthUpdateActionAdd |
| 305 | if s.coreManager != nil { |
| 306 | if _, ok := s.coreManager.GetByID(auth.ID); ok { |
| 307 | action = watcher.AuthUpdateActionModify |
| 308 | } |
| 309 | } |
| 310 | update := watcher.AuthUpdate{ |
| 311 | Action: action, |
| 312 | ID: auth.ID, |
| 313 | Auth: auth, |
| 314 | } |
| 315 | if s.watcher != nil && s.watcher.DispatchPersistedAuthUpdate(update) { |
| 316 | return nil |
| 317 | } |
| 318 | s.handleAuthUpdate(coreauth.WithSkipPersist(ctx), update) |
| 319 | return nil |
| 320 | } |
| 321 | } |
no test coverage detected