Bugfixes
This commit is contained in:
parent
34f098f76f
commit
863e5b3e49
|
@ -11,6 +11,7 @@ import { pubsub, AUTH_UPDATED } from '../pubsub'
|
|||
import { logError, logInfo, logSuccess, logWarning } from '../lib/logger'
|
||||
|
||||
import { performance } from 'perf_hooks'
|
||||
import { attributes } from '../lib/activeDirectory/attributes'
|
||||
class User {
|
||||
constructor(username) {
|
||||
this.username = username
|
||||
|
@ -384,7 +385,17 @@ class User {
|
|||
const startTime = performance.now()
|
||||
|
||||
// Do not promise.all, because it freezes the app
|
||||
for (const [index, user] of allAdUsers.entries()) {
|
||||
for (const [index, adUser] of allAdUsers.entries()) {
|
||||
if (!adUser.sAMAccountName) continue
|
||||
|
||||
const user = {}
|
||||
|
||||
for (const attribute of attributes.user) {
|
||||
if (adUser[attribute]) {
|
||||
user[attribute] = adUser[attribute]
|
||||
}
|
||||
}
|
||||
|
||||
const dbUser = await prisma.user.upsert({
|
||||
where: {
|
||||
sAMAccountName: user.sAMAccountName
|
||||
|
|
|
@ -16,7 +16,7 @@ const entryParser = (entry, raw, callback) => {
|
|||
if (raw.hasOwnProperty('lastLogonTimestamp'))
|
||||
entry.lastLogonTimestamp = ldapTimeToJSDate(raw.lastLogonTimestamp)
|
||||
|
||||
if (raw.hasOwnProperty('lockoutTime') && entry.lockoutTime !== '0')
|
||||
if (raw.hasOwnProperty('lockoutTime'))
|
||||
entry.lockoutTime = ldapTimeToJSDate(raw.lockoutTime)
|
||||
|
||||
if (raw.hasOwnProperty('extensionAttribute7'))
|
||||
|
@ -26,6 +26,7 @@ const entryParser = (entry, raw, callback) => {
|
|||
}
|
||||
|
||||
function ldapTimeToJSDate(ldapTime) {
|
||||
if (ldapTime === '0') return null
|
||||
return new Date(ldapTime / 1e4 - 1.16444736e13)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user