Skip to content

Commit

Permalink
Added: Exists Script
Browse files Browse the repository at this point in the history
  • Loading branch information
djuarezgf committed Feb 25, 2024
1 parent 8288db1 commit d4d8bd3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/main/java/de/samply/app/ProjectManagerConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/de/samply/app/ProjectManagerController.java
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,20 @@ public ResponseEntity<Resource> 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<Boolean> 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)
Expand Down

0 comments on commit d4d8bd3

Please sign in to comment.