16 lines
471 B
JavaScript
16 lines
471 B
JavaScript
import { sessionInfo } from "@/store";
|
|
|
|
export function hasPermission(permission, forValue) {
|
|
let hasPermission = false;
|
|
if (!sessionInfo.value.permissions) return 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);
|
|
}
|