fix: api permissions
This commit is contained in:
@@ -134,6 +134,7 @@ import {
|
||||
import { computed, inject, onMounted, ref } from 'vue'
|
||||
import { GraduationCap } from 'lucide-vue-next'
|
||||
import { sessionStore } from '../stores/session'
|
||||
import { useRouter } from 'vue-router'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import UserAvatar from '@/components/UserAvatar.vue'
|
||||
|
||||
@@ -145,8 +146,14 @@ const hiring = ref(false)
|
||||
const { brand } = sessionStore()
|
||||
const memberCount = ref(0)
|
||||
const dayjs = inject('$dayjs')
|
||||
const user = inject('$user')
|
||||
const router = useRouter()
|
||||
|
||||
onMounted(() => {
|
||||
if (!user.data) {
|
||||
router.push({ name: 'Courses' })
|
||||
return
|
||||
}
|
||||
setFiltersFromQuery()
|
||||
updateParticipants()
|
||||
})
|
||||
@@ -171,7 +178,7 @@ const categories = createListResource({
|
||||
doctype: 'LMS Certificate',
|
||||
url: 'lms.lms.api.get_certification_categories',
|
||||
cache: ['certification_categories'],
|
||||
auto: true,
|
||||
auto: user.data ? true : false,
|
||||
transform(data) {
|
||||
data.unshift({ label: __(' '), value: ' ' })
|
||||
return data
|
||||
|
||||
@@ -326,6 +326,7 @@
|
||||
@updateNotes="updateNotes"
|
||||
/>
|
||||
<VideoStatistics
|
||||
v-if="showStatsDialog"
|
||||
v-model="showStatsDialog"
|
||||
:lessonName="lesson.data?.name"
|
||||
:lessonTitle="lesson.data?.title"
|
||||
@@ -870,6 +871,7 @@ const scrollDiscussionsIntoView = () => {
|
||||
}
|
||||
|
||||
const updateNotes = () => {
|
||||
if (!user.data) return
|
||||
notes.update({
|
||||
filters: {
|
||||
lesson: lesson.data?.name,
|
||||
|
||||
@@ -185,10 +185,9 @@ const unReadNotifications = createListResource({
|
||||
doctype: 'Notification Log',
|
||||
url: 'lms.lms.api.get_notifications',
|
||||
filters: {
|
||||
for_user: user.data?.name,
|
||||
read: 0,
|
||||
},
|
||||
auto: true,
|
||||
auto: user.data ? true : false,
|
||||
cache: 'Unread Notifications',
|
||||
})
|
||||
|
||||
@@ -196,18 +195,17 @@ const readNotifications = createListResource({
|
||||
doctype: 'Notification Log',
|
||||
url: 'lms.lms.api.get_notifications',
|
||||
filters: {
|
||||
for_user: user.data?.name,
|
||||
read: 1,
|
||||
},
|
||||
auto: true,
|
||||
auto: user.data ? true : false,
|
||||
cache: 'Read Notifications',
|
||||
})
|
||||
|
||||
const markAsRead = createResource({
|
||||
url: 'lms.lms.api.mark_as_read',
|
||||
url: 'frappe.desk.doctype.notification_log.notification_log.mark_as_read',
|
||||
makeParams(values) {
|
||||
return {
|
||||
name: values.name,
|
||||
docname: values.name,
|
||||
}
|
||||
},
|
||||
onSuccess(data) {
|
||||
@@ -217,7 +215,7 @@ const markAsRead = createResource({
|
||||
})
|
||||
|
||||
const markAllAsRead = createResource({
|
||||
url: 'lms.lms.api.mark_all_as_read',
|
||||
url: 'frappe.desk.doctype.notification_log.notification_log.mark_all_as_read',
|
||||
onSuccess(data) {
|
||||
unReadNotifications.reload()
|
||||
readNotifications.reload()
|
||||
|
||||
Reference in New Issue
Block a user