mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-10 17:30:51 +00:00
EQMS-1484: Fixed permission checks when sending a QMS document for approval from the Workflow Validation tab (#8628)
Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
parent
5423aa5047
commit
d4517bbbdb
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import documents from '@hcengineering/controlled-documents'
|
||||
import documents, { ControlledDocumentState } from '@hcengineering/controlled-documents'
|
||||
import { Label, Button, showPopup } from '@hcengineering/ui'
|
||||
|
||||
import TeamPopup from '../../TeamPopup.svelte'
|
||||
@ -15,9 +15,12 @@
|
||||
return
|
||||
}
|
||||
|
||||
const isReviewed = $controlledDocument.controlledState === ControlledDocumentState.Reviewed
|
||||
|
||||
const teamPopupData: TeamPopupData = {
|
||||
controlledDoc: $controlledDocument,
|
||||
requestClass: documents.class.DocumentApprovalRequest
|
||||
requestClass: documents.class.DocumentApprovalRequest,
|
||||
requireSignature: !isReviewed
|
||||
}
|
||||
|
||||
showPopup(TeamPopup, teamPopupData, 'center')
|
||||
|
@ -15,7 +15,8 @@
|
||||
import documentsRes from '../../../plugin'
|
||||
import {
|
||||
$controlledDocument as controlledDocument,
|
||||
$documentSnapshots as documentSnapshots
|
||||
$documentSnapshots as documentSnapshots,
|
||||
$isDocumentOwner as isDocumentOwner
|
||||
} from '../../../stores/editors/document'
|
||||
import DocumentApprovalGuideItem from './DocumentApprovalGuideItem.svelte'
|
||||
import DocumentApprovalItem from './DocumentApprovalItem.svelte'
|
||||
@ -61,7 +62,8 @@
|
||||
ControlledDocumentState.Rejected,
|
||||
ControlledDocumentState.InApproval
|
||||
]
|
||||
$: hasGuide = doc && doc.state === DocumentState.Draft && !noGuideStates.includes(doc.controlledState)
|
||||
$: hasGuide =
|
||||
doc && doc.state === DocumentState.Draft && !noGuideStates.includes(doc.controlledState) && $isDocumentOwner
|
||||
</script>
|
||||
|
||||
<RightPanelTabHeader>
|
||||
|
@ -17,7 +17,14 @@ import { ControlledDocumentState, DocumentState } from '@hcengineering/controlle
|
||||
import { TrainingState } from '@hcengineering/training'
|
||||
import { combine } from 'effector'
|
||||
import { $documentComments } from './documentComments'
|
||||
import { $controlledDocument, $documentState, $isLatestVersion, $reviewRequestHistory, $training } from './editor'
|
||||
import {
|
||||
$controlledDocument,
|
||||
$documentState,
|
||||
$isDocumentOwner,
|
||||
$isLatestVersion,
|
||||
$reviewRequestHistory,
|
||||
$training
|
||||
} from './editor'
|
||||
|
||||
export const $canSendForApproval = combine(
|
||||
$controlledDocument,
|
||||
@ -26,7 +33,10 @@ export const $canSendForApproval = combine(
|
||||
$documentComments,
|
||||
$training,
|
||||
$reviewRequestHistory,
|
||||
(document, isLatestVersion, state, comments, training, reviewHistory) => {
|
||||
$isDocumentOwner,
|
||||
(document, isLatestVersion, state, comments, training, reviewHistory, isDocumentOwner) => {
|
||||
if (!isDocumentOwner) return false
|
||||
|
||||
let haveBeenReviewedOnce = false
|
||||
if (document !== null) {
|
||||
const reviews = (reviewHistory ?? []).filter((review) => review.attachedTo === document._id)
|
||||
|
@ -15,10 +15,11 @@
|
||||
|
||||
import { DocumentState } from '@hcengineering/controlled-documents'
|
||||
import { combine } from 'effector'
|
||||
import { $documentState, $isLatestVersion } from './editor'
|
||||
import { $documentState, $isDocumentOwner, $isLatestVersion } from './editor'
|
||||
|
||||
export const $canSendForReview = combine(
|
||||
$isLatestVersion,
|
||||
$documentState,
|
||||
(isLatestVersion, state) => isLatestVersion && state === DocumentState.Draft
|
||||
$isDocumentOwner,
|
||||
(isLatestVersion, state, isDocumentOwner) => isLatestVersion && state === DocumentState.Draft && isDocumentOwner
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user