mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-10-05 17:29:04 +02:00
refactor: migrate LDAP sync to an actor (#1651)
Co-authored-by: Kyle Mendell <kmendell@ofkm.us>
This commit is contained in:
co-authored by
Kyle Mendell
parent
f8db1d8a86
commit
563c0f93a6
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/pocket-id/pocket-id/backend/internal/emailverification"
|
||||
"github.com/pocket-id/pocket-id/backend/internal/geolite"
|
||||
"github.com/pocket-id/pocket-id/backend/internal/job"
|
||||
"github.com/pocket-id/pocket-id/backend/internal/ldapsync"
|
||||
"github.com/pocket-id/pocket-id/backend/internal/oidc"
|
||||
"github.com/pocket-id/pocket-id/backend/internal/onetimeaccess"
|
||||
"github.com/pocket-id/pocket-id/backend/internal/service"
|
||||
@@ -36,12 +37,12 @@ type services struct {
|
||||
customClaimService *service.CustomClaimService
|
||||
oidcService *service.OidcService
|
||||
userGroupService *service.UserGroupService
|
||||
ldapService *service.LdapService
|
||||
versionService *service.VersionService
|
||||
fileStorage storage.FileStorage
|
||||
|
||||
apiKeyModule *apikey.Module
|
||||
deviceLoginModule *devicelogin.Module
|
||||
ldapSyncModule *ldapsync.Module
|
||||
oidcModule *oidc.Module
|
||||
webauthnModule *webauthn.Module
|
||||
userSignUpModule *usersignup.Module
|
||||
@@ -152,7 +153,21 @@ func initServices(
|
||||
|
||||
svc.userGroupService = service.NewUserGroupService(db, svc.scimService)
|
||||
svc.userService = service.NewUserService(db, svc.jwtService, svc.auditLogService, svc.customClaimService, svc.appImagesService, svc.scimService, fileStorage)
|
||||
svc.ldapService = service.NewLdapService(db, httpClient, svc.userService, svc.userGroupService, fileStorage)
|
||||
|
||||
svc.ldapSyncModule, err = ldapsync.New(ldapsync.Dependencies{
|
||||
DB: db,
|
||||
Actors: actors,
|
||||
HTTPClient: httpClient,
|
||||
FileStorage: fileStorage,
|
||||
Users: svc.userService,
|
||||
Groups: svc.userGroupService,
|
||||
AppConfig: svc.appConfigService,
|
||||
// Disable in test environment
|
||||
ScheduleDisabled: common.EnvConfig.AppEnv.IsTest(),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create LDAP sync module: %w", err)
|
||||
}
|
||||
|
||||
svc.apiKeyModule, err = apikey.New(ctx, apikey.Dependencies{
|
||||
DB: db,
|
||||
|
||||
Reference in New Issue
Block a user