fix: evaluators can only edit batches where they are instructors

This commit is contained in:
Jannat Patel
2025-12-02 16:14:17 +05:30
parent 7bc6dff6ea
commit 6c16516e89

View File

@@ -113,7 +113,7 @@
{{ __('Enroll Now') }}
</Button>
<router-link
v-if="canCreateBatch"
v-if="canEditBatch"
:to="{
name: 'BatchForm',
params: {
@@ -209,11 +209,19 @@ const isEvaluator = computed(() => {
return user.data?.is_evaluator
})
const isInstructor = computed(() => {
return (
props.batch.data?.instructors?.filter(
(instructor) => instructor.name === user.data?.name
).length > 0
)
})
const canAccessBatch = computed(() => {
return isModerator.value || isStudent.value || isEvaluator.value
})
const canCreateBatch = computed(() => {
return isModerator.value || isEvaluator.value
const canEditBatch = computed(() => {
return isModerator.value || isInstructor.value
})
</script>