Allow updating remote timetables with permission

This commit is contained in:
2023-06-20 20:22:51 +02:00
parent 5d9317ac01
commit 41c0d329fb
5 changed files with 91 additions and 5 deletions

14
src/permission.js Normal file
View File

@ -0,0 +1,14 @@
import { sessionInfo } from "@/store";
export function hasPermission(permission, forValue) {
let hasPermission = false;
for (const perm of sessionInfo.value.permissions) {
if (perm == permission) hasPermission = true;
else if (perm == permission + ":" + forValue) hasPermission = true;
}
return hasPermission;
}
export function canEditTimetable(id) {
return hasPermission("timetable.update", id);
}