✨ Allow updating remote timetables with permission
This commit is contained in:
14
src/permission.js
Normal file
14
src/permission.js
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user