fix: permission issue when cancelling evaluation
This commit is contained in:
@@ -162,8 +162,12 @@ describe("Batch Creation", () => {
|
||||
/* Add student to batch */
|
||||
cy.get("button").contains("Students").click();
|
||||
cy.get("button").contains("Add").click();
|
||||
cy.get('div[role="dialog"]').first().find("button").eq(1).click();
|
||||
cy.get("input[id^='headlessui-combobox-input-v-']").type(randomEmail);
|
||||
cy.get('div[role="dialog"]')
|
||||
.first()
|
||||
.find("input[id^='headlessui-combobox-input-v-']")
|
||||
.first()
|
||||
.click();
|
||||
cy.get("input[placeholder='Search']").type(randomEmail);
|
||||
cy.get("div").contains(randomEmail).click();
|
||||
cy.get("button").contains("Submit").click();
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<Link
|
||||
doctype="User"
|
||||
v-model="student"
|
||||
:filters="{ ignore_user_type: 1 }"
|
||||
placeholder=" "
|
||||
:label="__('Student')"
|
||||
:onCreate="
|
||||
|
||||
@@ -137,7 +137,7 @@ import {
|
||||
} from 'lucide-vue-next'
|
||||
import { inject, ref, getCurrentInstance, computed } from 'vue'
|
||||
import { formatTime } from '@/utils'
|
||||
import { Button, createResource, createListResource, call } from 'frappe-ui'
|
||||
import { Button, createListResource, call, toast } from 'frappe-ui'
|
||||
import EvaluationModal from '@/components/Modals/EvaluationModal.vue'
|
||||
import { Menu, MenuButton, MenuItems, MenuItem } from '@headlessui/vue'
|
||||
|
||||
@@ -183,6 +183,7 @@ const upcoming_evals = createListResource({
|
||||
'start_time',
|
||||
'evaluator_name',
|
||||
'course_title',
|
||||
'member',
|
||||
'google_meet_link',
|
||||
],
|
||||
orderBy: 'date',
|
||||
@@ -227,11 +228,15 @@ const cancelEvaluation = (evl) => {
|
||||
theme: 'red',
|
||||
variant: 'solid',
|
||||
onClick(close) {
|
||||
call('lms.lms.api.cancel_evaluation', { evaluation: evl }).then(
|
||||
() => {
|
||||
call('lms.lms.api.cancel_evaluation', { evaluation: evl })
|
||||
.then(() => {
|
||||
upcoming_evals.reload()
|
||||
}
|
||||
)
|
||||
toast.success(__('Evaluation cancelled successfully'))
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.error(__(err.messages?.[0] || err))
|
||||
console.error(err)
|
||||
})
|
||||
close()
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1308,6 +1308,7 @@ def get_lms_settings():
|
||||
@frappe.whitelist()
|
||||
def cancel_evaluation(evaluation: dict):
|
||||
evaluation = frappe._dict(evaluation)
|
||||
print(evaluation.member, frappe.session.user)
|
||||
if evaluation.member != frappe.session.user:
|
||||
frappe.throw(_("You do not have permission to cancel this evaluation."), frappe.PermissionError)
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ def execute():
|
||||
is_shared = frappe.db.exists("DocShare", filters)
|
||||
if not is_shared:
|
||||
share = frappe.new_doc("DocShare")
|
||||
filters.update({"read": 1, "notify_by_email": 0})
|
||||
filters.update({"read": 1, "write": 1, "notify_by_email": 0})
|
||||
share.update(filters)
|
||||
share.save()
|
||||
|
||||
Reference in New Issue
Block a user