Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/assets/vue/composables/userPermissions.js

32 lines
742 B

import { storeToRefs } from "pinia"
import { useCidReqStore } from "../store/cidReq"
import axios from "axios"
export async function checkIsAllowedToEdit(
tutor = false,
coach = false,
sessionCoach = false,
checkStudentView = true,
) {
const cidReqStore = useCidReqStore()
const { course, session } = storeToRefs(cidReqStore)
try {
const { data } = await axios.get(window.location.origin + "/permissions/is_allowed_to_edit", {
params: {
tutor,
coach,
sessioncoach: sessionCoach,
checkstudentview: checkStudentView,
cid: course.value?.id,
sid: session.value?.id,
},
})
return data.isAllowedToEdit
} catch (e) {
console.log(e)
}
return false
}