Adjust addCategoryApps for device specific assignments

This commit is contained in:
Jonas Lochmann
2022-03-14 01:00:00 +01:00
parent 7c65aba589
commit 6d635b7e25
@@ -1,6 +1,6 @@
/*
* server component for the TimeLimit App
* Copyright (C) 2019 - 2020 Jonas Lochmann
* Copyright (C) 2019 - 2022 Jonas Lochmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -80,6 +80,16 @@ export async function dispatchAddCategoryApps ({ action, cache, fromChildSelfLim
})).map((item) => item.categoryId)
if (fromChildSelfLimitAddChildUserId !== null) {
for (let i = 0; i < action.packageNames.length; i++) {
const packageName = action.packageNames[i]
if (packageName.indexOf('@') !== -1) {
throw new SelfLimitationException({
staticMessage: 'can not do device specific assignments as child'
})
}
}
try {
const parentCategoriesOfTargetCategory = getCategoryWithParentCategories(categoriesOfSameChild, action.categoryId)
const userEntryUnsafe = await cache.database.user.findOne({