From d4d8bd331ef17d5f326b5979ecc371b114d55753 Mon Sep 17 00:00:00 2001 From: juarez Date: Sun, 25 Feb 2024 22:07:59 +0100 Subject: [PATCH] Added: Exists Script --- CHANGELOG.md | 1 + .../java/de/samply/app/ProjectManagerConst.java | 2 ++ .../de/samply/app/ProjectManagerController.java | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fe4da2..0de4752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,3 +106,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Flag ENABLE_TOKEN_MANAGER - Content Disposition in exposed headers - Exists Votum and Application Form +- Exists Script diff --git a/src/main/java/de/samply/app/ProjectManagerConst.java b/src/main/java/de/samply/app/ProjectManagerConst.java index fd9cbf5..24668e2 100644 --- a/src/main/java/de/samply/app/ProjectManagerConst.java +++ b/src/main/java/de/samply/app/ProjectManagerConst.java @@ -52,6 +52,7 @@ public class ProjectManagerConst { public final static String EXISTS_VOTUM_ACTION = "EXISTS_VOTUM"; public final static String DOWNLOAD_APPLICATION_FORM_ACTION = "DOWNLOAD_APPLICATION_FORM"; public final static String EXISTS_APPLICATION_FORM_ACTION = "EXISTS_APPLICATION_FORM"; + public final static String EXISTS_SCRIPT_ACTION = "EXISTS_SCRIPT"; public final static String DOWNLOAD_PUBLICATION_ACTION = "DOWNLOAD_PUBLICATION"; public final static String DOWNLOAD_SCRIPT_ACTION = "DOWNLOAD_SCRIPT"; public final static String DOWNLOAD_OTHER_DOCUMENT_ACTION = "DOWNLOAD_OTHER_DOCUMENT"; @@ -128,6 +129,7 @@ public class ProjectManagerConst { public final static String EXISTS_APPLICATION_FORM = "/exists-application-form"; public final static String DOWNLOAD_PUBLICATION = "/download-publication"; public final static String DOWNLOAD_SCRIPT = "/download-script"; + public final static String EXISTS_SCRIPT = "/exists-script"; public final static String DOWNLOAD_OTHER_DOCUMENT = "/download-other-document"; public final static String DOWNLOAD_APPLICATION_FORM_TEMPLATE = "/download-application-form-template"; public final static String SAVE_QUERY_IN_BRIDGEHEAD = "/save-query-in-bridgehead"; diff --git a/src/main/java/de/samply/app/ProjectManagerController.java b/src/main/java/de/samply/app/ProjectManagerController.java index f679de3..da63c2b 100644 --- a/src/main/java/de/samply/app/ProjectManagerController.java +++ b/src/main/java/de/samply/app/ProjectManagerController.java @@ -679,6 +679,20 @@ public ResponseEntity downloadScript( return downloadProjectDocument(projectCode, null, DocumentType.SCRIPT); } + @RoleConstraints(projectRoles = {ProjectRole.DEVELOPER, ProjectRole.PILOT, ProjectRole.FINAL, ProjectRole.BRIDGEHEAD_ADMIN, ProjectRole.PROJECT_MANAGER_ADMIN}) + @StateConstraints(projectStates = {ProjectState.DEVELOP, ProjectState.PILOT, ProjectState.FINAL, ProjectState.FINISHED}) + @ProjectConstraints(projectTypes = {ProjectType.DATASHIELD}) + @FrontendSiteModule(site = ProjectManagerConst.PROJECT_VIEW_SITE, module = ProjectManagerConst.PROJECT_DOCUMENTS_MODULE) + @FrontendAction(action = ProjectManagerConst.EXISTS_SCRIPT_ACTION) + @GetMapping(value = ProjectManagerConst.EXISTS_SCRIPT) + public ResponseEntity existsScript( + @ProjectCode @RequestParam(name = ProjectManagerConst.PROJECT_CODE) String projectCode, + // bridgehead required for identifying developer user or bridgehead admin in role constraints + @Bridgehead @RequestParam(name = ProjectManagerConst.BRIDGEHEAD, required = false) String bridgehead + ) throws DocumentServiceException { + return existsProjectDocument(projectCode, null, DocumentType.SCRIPT); + } + @RoleConstraints(projectRoles = {ProjectRole.CREATOR, ProjectRole.BRIDGEHEAD_ADMIN, ProjectRole.PROJECT_MANAGER_ADMIN}) @StateConstraints(projectStates = {ProjectState.CREATED, ProjectState.ACCEPTED, ProjectState.DEVELOP, ProjectState.PILOT, ProjectState.FINAL}) @FrontendSiteModule(site = ProjectManagerConst.PROJECT_VIEW_SITE, module = ProjectManagerConst.PROJECT_DOCUMENTS_MODULE)