Skip to content

Commit

Permalink
Merge pull request #934 from navikt/write-access-dua
Browse files Browse the repository at this point in the history
Set access rights for ROL for DUA.
  • Loading branch information
flexable777 authored Sep 25, 2023
2 parents 3f40488 + ab8aa00 commit c0c446a
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 39 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ val jacksonJsonschemaVersion = "1.0.39"
val pdfboxVersion = "3.0.0"
val tikaVersion = "2.9.0"
val verapdfVersion = "1.24.1"
val klageKodeverkVersion = "1.6.5"
val klageKodeverkVersion = "1.6.8"

plugins {
val kotlinVersion = "1.9.10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class DokumentUnderArbeidController(
opplastetFil = opplastetFil,
innloggetIdent = innloggetSaksbehandlerService.getInnloggetIdent(),
tittel = opplastetFil.title,
parentId = input.parentId,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class SmartEditorController(
smartEditorTemplateId = body.templateId,
innloggetIdent = innloggetSaksbehandlerService.getInnloggetIdent(),
tittel = body.tittel ?: DokumentType.VEDTAK.defaultFilnavn,
parentId = body.parentId,
)

val smartEditorId =
Expand Down Expand Up @@ -117,7 +118,7 @@ class SmartEditorController(
readOnly = false
)

dokumentUnderArbeidService.validateDocumentNotFinalized(dokumentId = dokumentId)
dokumentUnderArbeidService.validateDocument(dokumentId = dokumentId)

if (input.templateId != null) {
dokumentUnderArbeidService.updateSmartEditorTemplateId(
Expand Down Expand Up @@ -165,7 +166,9 @@ class SmartEditorController(
@PathVariable("dokumentId") documentId: UUID,
@RequestBody commentInput: CommentInput
): CommentOutput {
//TODO: Skal hvem som helst få kommentere?

dokumentUnderArbeidService.validateDocument(documentId)

val smartEditorId =
dokumentUnderArbeidService.getSmartEditorId(
dokumentId = documentId,
Expand All @@ -185,6 +188,9 @@ class SmartEditorController(
@PathVariable("commentId") commentId: UUID,
@RequestBody modifyCommentInput: ModifyCommentInput
): CommentOutput {

dokumentUnderArbeidService.validateDocument(documentId)

val smartEditorId =
dokumentUnderArbeidService.getSmartEditorId(
dokumentId = documentId,
Expand Down Expand Up @@ -225,7 +231,8 @@ class SmartEditorController(
@PathVariable("commentId") commentId: UUID,
@RequestBody commentInput: CommentInput,
): CommentOutput {
//TODO: Skal hvem som helst få kommentere?
dokumentUnderArbeidService.validateDocument(documentId)

val smartEditorId =
dokumentUnderArbeidService.getSmartEditorId(
dokumentId = documentId,
Expand Down Expand Up @@ -262,6 +269,8 @@ class SmartEditorController(
@PathVariable("dokumentId") documentId: UUID,
@PathVariable("commentId") commentId: UUID
) {
dokumentUnderArbeidService.validateDocument(documentId)

val smartEditorId =
dokumentUnderArbeidService.getSmartEditorId(
dokumentId = documentId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class DokumentMapper(
parentId = dokumentUnderArbeid.parentId,
type = type,
journalfoertDokumentReference = journalfoertDokumentReference,
creatorIdent = dokumentUnderArbeid.creatorIdent,
creatorRole = dokumentUnderArbeid.creatorRole,
)
}

Expand Down Expand Up @@ -130,6 +132,8 @@ class DokumentMapper(
content = jacksonObjectMapper().readTree(smartEditorDocument.json),
created = smartEditorDocument.created,
modified = smartEditorDocument.modified,
creatorIdent = dokumentUnderArbeid.creatorIdent,
creatorRole = dokumentUnderArbeid.creatorRole,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import java.util.*
data class FilInput(
val file: MultipartFile,
val dokumentTypeId: String = DokumentType.NOTAT.id,
val parentId: UUID?,
)

data class SmartHovedDokumentInput(
Expand All @@ -16,6 +17,7 @@ data class SmartHovedDokumentInput(
val tittel: String?,
val dokumentTypeId: String? = null,
val version: Int?,
val parentId: UUID?,
)

data class PatchSmartHovedDokumentInput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package no.nav.klage.dokument.api.view

import com.fasterxml.jackson.databind.JsonNode
import no.nav.klage.dokument.domain.dokumenterunderarbeid.DokumentUnderArbeid
import no.nav.klage.oppgave.domain.klage.BehandlingRole
import java.time.LocalDateTime
import java.util.*

Expand All @@ -24,6 +25,8 @@ data class DokumentView(
val parent: UUID?,
val parentId: UUID?,
val journalfoertDokumentReference: JournalfoertDokumentReference?,
val creatorIdent: String,
val creatorRole: BehandlingRole,
) {
data class JournalfoertDokumentReference (
val journalpostId: String,
Expand Down Expand Up @@ -64,4 +67,6 @@ data class SmartEditorDocumentView(
//Deprecated
val parent: UUID?,
val parentId: UUID?,
val creatorIdent: String,
val creatorRole: BehandlingRole,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package no.nav.klage.dokument.domain.dokumenterunderarbeid

import jakarta.persistence.*
import no.nav.klage.kodeverk.DokumentType
import no.nav.klage.oppgave.domain.klage.BehandlingRole
import no.nav.klage.oppgave.domain.klage.DokumentTypeConverter
import org.hibernate.annotations.BatchSize
import org.hibernate.annotations.DynamicUpdate
Expand Down Expand Up @@ -67,7 +68,12 @@ open class DokumentUnderArbeid(
AttributeOverride(name = "dokumentInfoId", column = Column(name = "journalfoert_dokument_dokument_info_id")),
]
)
val journalfoertDokumentReference: JournalfoertDokumentReference?
val journalfoertDokumentReference: JournalfoertDokumentReference?,
@Column(name = "creator_ident")
open var creatorIdent: String,
@Column(name = "creator_role")
@Enumerated(EnumType.STRING)
open var creatorRole: BehandlingRole,
) : Comparable<DokumentUnderArbeid> {

override fun compareTo(other: DokumentUnderArbeid): Int =
Expand Down
Loading

0 comments on commit c0c446a

Please sign in to comment.