fix(ldapSync): bug fix - don't delete guests
Build and Push Docker image / build-and-push (push) Successful in 3m1s
Details
Build and Push Docker image / build-and-push (push) Successful in 3m1s
Details
This fixes the issue where the ldap sync deleted all guest users after one day
This commit is contained in:
parent
4d31f8de68
commit
692f2eb0e0
|
@ -181,13 +181,13 @@ func syncLdapUsers(app *pocketbase.PocketBase, ldapClient *ldap.Conn) SyncResult
|
||||||
var removedCount int
|
var removedCount int
|
||||||
|
|
||||||
// remove old users
|
// remove old users
|
||||||
// step1: get a timeStamp one day ago
|
// step1: get a timeStamp ten minutes ago
|
||||||
timeStamp := time.Now().AddDate(0, 0, -1)
|
timeStamp := time.Now().Add(time.Minute * -10)
|
||||||
|
|
||||||
// step2: get all users that have not been synced since that timeStamp
|
// step2: get all users that have not been synced since that timeStamp
|
||||||
records, err := app.Dao().FindRecordsByFilter(
|
records, err := app.Dao().FindRecordsByFilter(
|
||||||
ldapUsersTableName,
|
ldapUsersTableName,
|
||||||
"updated < {:timeStamp}", "", 0, 0,
|
"updated < {:timeStamp} && REALM = 'LDAP'", "", 0, 0,
|
||||||
dbx.Params{"timeStamp": timeStamp},
|
dbx.Params{"timeStamp": timeStamp},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue