feat: integrate policy checks for feature enablement in calendar, folder, and plugins settings

This commit is contained in:
Linus Rath
2026-03-25 11:06:35 +01:00
parent 05f6d61cea
commit f64306be5e
4 changed files with 57 additions and 17 deletions
+17 -1
View File
@@ -129,8 +129,24 @@ export async function POST(request: NextRequest) {
const filteredSettings = { ...settings };
for (const key of Object.keys(filteredSettings)) {
const restriction = policy.restrictions[key];
if (restriction?.locked) {
if (!restriction) continue;
if (restriction.locked) {
delete filteredSettings[key];
continue;
}
const value = filteredSettings[key];
if (restriction.allowedValues && restriction.allowedValues.length > 0) {
if (!restriction.allowedValues.includes(value)) {
delete filteredSettings[key];
}
}
if (typeof value === 'number') {
if (restriction.min !== undefined && value < restriction.min) {
delete filteredSettings[key];
}
if (restriction.max !== undefined && value > restriction.max) {
delete filteredSettings[key];
}
}
}