Add preblocking

This commit is contained in:
Jonas Lochmann 2020-12-21 01:00:00 +01:00
parent 13ede06a91
commit 2bb3777484
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
23 changed files with 615 additions and 71 deletions

View file

@ -67,19 +67,21 @@ export async function getUserList ({ database, transaction, familyEntry }: {
},
attributes: [
'userId',
'categoryId'
'categoryId',
'preBlockDuration'
],
transaction
})).map((item) => ({
userId: item.userId,
categoryId: item.categoryId
categoryId: item.categoryId,
preBlockDuration: item.preBlockDuration
}))
const getLimitLoginCategory = (userId: string) => {
const item = limitLoginCategories.find((item) => item.userId === userId)
if (item) {
return item.categoryId
return item
} else {
return undefined
}
@ -87,22 +89,27 @@ export async function getUserList ({ database, transaction, familyEntry }: {
return {
version: familyEntry.userListVersion,
data: users.map((item) => ({
id: item.userId,
name: item.name,
password: item.passwordHash,
secondPasswordSalt: item.secondPasswordSalt,
type: item.type,
timeZone: item.timeZone,
disableLimitsUntil: parseInt(item.disableTimelimitsUntil, 10),
mail: item.mail,
currentDevice: item.currentDevice,
categoryForNotAssignedApps: item.categoryForNotAssignedApps,
relaxPrimaryDevice: item.relaxPrimaryDeviceRule,
mailNotificationFlags: item.mailNotificationFlags,
blockedTimes: '',
flags: parseInt(item.flags, 10),
llc: getLimitLoginCategory(item.userId)
}))
data: users.map((item) => {
const limitLoginCategory = getLimitLoginCategory(item.userId)
return {
id: item.userId,
name: item.name,
password: item.passwordHash,
secondPasswordSalt: item.secondPasswordSalt,
type: item.type,
timeZone: item.timeZone,
disableLimitsUntil: parseInt(item.disableTimelimitsUntil, 10),
mail: item.mail,
currentDevice: item.currentDevice,
categoryForNotAssignedApps: item.categoryForNotAssignedApps,
relaxPrimaryDevice: item.relaxPrimaryDeviceRule,
mailNotificationFlags: item.mailNotificationFlags,
blockedTimes: '',
flags: parseInt(item.flags, 10),
llc: limitLoginCategory?.categoryId,
pbd: limitLoginCategory?.preBlockDuration
}
})
}
}