mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-08 17:00:47 +00:00
18 lines
671 B
TypeScript
18 lines
671 B
TypeScript
//
|
|
// Copyright @ 2024 Hardcore Engineering Inc.
|
|
//
|
|
|
|
import { checkMyPermission, permissionsStore } from '@hcengineering/view-resources'
|
|
import type { TrainingRequest } from '@hcengineering/training'
|
|
import { get } from 'svelte/store'
|
|
import { getCurrentEmployeeRef } from './getCurrentEmployeeRef'
|
|
import training from '../plugin'
|
|
|
|
export function canViewTrainingRequest (object: TrainingRequest): boolean {
|
|
return (
|
|
object.owner === getCurrentEmployeeRef() ||
|
|
checkMyPermission(training.permission.ViewSomeoneElsesSentRequest, object.space, get(permissionsStore)) ||
|
|
(object.trainees.includes(getCurrentEmployeeRef()) && object.canceledOn === null)
|
|
)
|
|
}
|