From 6d635b7e2523aa3401263b2c3d6b1fa76c8613a6 Mon Sep 17 00:00:00 2001 From: Jonas Lochmann Date: Mon, 14 Mar 2022 01:00:00 +0100 Subject: [PATCH] Adjust addCategoryApps for device specific assignments --- .../dispatch-parent-action/addcategoryapps.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/function/sync/apply-actions/dispatch-parent-action/addcategoryapps.ts b/src/function/sync/apply-actions/dispatch-parent-action/addcategoryapps.ts index a85927a..a588681 100644 --- a/src/function/sync/apply-actions/dispatch-parent-action/addcategoryapps.ts +++ b/src/function/sync/apply-actions/dispatch-parent-action/addcategoryapps.ts @@ -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({