diff --git a/webapi/src/main/scala/org/knora/webapi/slice/admin/api/service/ProjectsADMRestService.scala b/webapi/src/main/scala/org/knora/webapi/slice/admin/api/service/ProjectsADMRestService.scala index b2082be847..d97477efa0 100644 --- a/webapi/src/main/scala/org/knora/webapi/slice/admin/api/service/ProjectsADMRestService.scala +++ b/webapi/src/main/scala/org/knora/webapi/slice/admin/api/service/ProjectsADMRestService.scala @@ -5,13 +5,10 @@ package org.knora.webapi.slice.admin.api.service -import zio.* -import zio.macros.accessible - import dsp.errors.BadRequestException import dsp.errors.NotFoundException -import org.knora.webapi.messages.admin.responder.projectsmessages.ProjectIdentifierADM.* import org.knora.webapi.messages.admin.responder.projectsmessages.* +import org.knora.webapi.messages.admin.responder.projectsmessages.ProjectIdentifierADM.* import org.knora.webapi.responders.admin.ProjectsResponderADM import org.knora.webapi.slice.admin.api.model.ProjectDataGetResponseADM import org.knora.webapi.slice.admin.api.model.ProjectExportInfoResponse @@ -30,6 +27,8 @@ import org.knora.webapi.slice.admin.domain.service.ProjectExportService import org.knora.webapi.slice.admin.domain.service.ProjectImportService import org.knora.webapi.slice.common.api.AuthorizationRestService import org.knora.webapi.slice.common.api.KnoraResponseRenderer +import zio.* +import zio.macros.accessible @accessible trait ProjectADMRestService { @@ -284,8 +283,8 @@ final case class ProjectsADMRestServiceLive( project <- projectRepo.findById(id).someOrFail(NotFoundException(s"Project '${getId(id)}' not found.")) _ <- permissionService.ensureSystemAdminOrProjectAdmin(user, project) restrictedView <- req.toRestrictedView - _ <- projectService.setProjectRestrictedView(project, restrictedView) - } yield RestrictedViewResponse.from(restrictedView) + newSettings <- projectService.setProjectRestrictedView(project, restrictedView) + } yield RestrictedViewResponse.from(newSettings) override def exportProject(shortcodeStr: String, user: User): Task[Unit] = convertStringToShortcodeId(shortcodeStr).flatMap(exportProject(_, user)) diff --git a/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/service/ProjectADMService.scala b/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/service/ProjectADMService.scala index a98f9aa9c6..e1b7ca5fde 100644 --- a/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/service/ProjectADMService.scala +++ b/webapi/src/main/scala/org/knora/webapi/slice/admin/domain/service/ProjectADMService.scala @@ -96,15 +96,15 @@ final case class ProjectADMService( .map(_ :+ projectGraph) } - def setProjectRestrictedView(project: KnoraProject, settings: RestrictedView): Task[Unit] = { + def setProjectRestrictedView(project: KnoraProject, settings: RestrictedView): Task[RestrictedView] = { val newSettings = settings match { case RestrictedView.Watermark(false) => RestrictedView.default case s => s } - projectRepo.setProjectRestrictedView(project, newSettings) + projectRepo.setProjectRestrictedView(project, newSettings).as(newSettings) } - def setProjectRestrictedView(project: ProjectADM, settings: RestrictedView): Task[Unit] = + def setProjectRestrictedView(project: ProjectADM, settings: RestrictedView): Task[RestrictedView] = setProjectRestrictedView(toKnoraProject(project), settings) }