diff --git a/packages/code-server/code-server-lib/src/main/java/com/daimler/data/service/workspace/BaseWorkspaceService.java b/packages/code-server/code-server-lib/src/main/java/com/daimler/data/service/workspace/BaseWorkspaceService.java index a789bd2288..d16f547898 100644 --- a/packages/code-server/code-server-lib/src/main/java/com/daimler/data/service/workspace/BaseWorkspaceService.java +++ b/packages/code-server/code-server-lib/src/main/java/com/daimler/data/service/workspace/BaseWorkspaceService.java @@ -131,6 +131,12 @@ public class BaseWorkspaceService implements WorkspaceService { @Value("${codeServer.codespace.filename}") private String codespaceFileName; + + @Value("${codeServer.run.collab.admin}") + private boolean runCollabByAdmin; + + @Value("${codeServer.collab.adminbypass.projectname}") + private String collabProjectName; @Autowired private WorkspaceAssembler workspaceAssembler; @@ -1724,7 +1730,11 @@ public GenericMessage addCollabById(String userId, CodeServerWorkspaceVO vo, Use if(! (vo.getProjectDetails().getRecipeDetails().getRecipeId().name().toLowerCase().startsWith("public") || vo.getProjectDetails().getRecipeDetails().getRecipeId().name().toLowerCase().startsWith("private") || vo.getProjectDetails().getRecipeDetails().getRecipeId().name().toLowerCase().equalsIgnoreCase("default"))) { - HttpStatus addGitUser = gitClient.addUserToRepo(gitUser, repoName); + if(runCollabByAdmin && vo.getProjectDetails().getProjectName().equals(collabProjectName)){ + gitUser = collabPid; + log.info("Admin for collab bypassed for project name "+collabProjectName); + } + HttpStatus addGitUser = gitClient.addUserToRepo(gitUser, repoName); if(addGitUser == HttpStatus.UNPROCESSABLE_ENTITY){ log.info("Failed while adding {} as collaborator with status {}", repoName, userRequestDto.getGitUserName(), addGitUser.name()); diff --git a/packages/code-server/code-server-lib/src/main/resources/application.yml b/packages/code-server/code-server-lib/src/main/resources/application.yml index 87c060efa1..3e4c3cb7cd 100644 --- a/packages/code-server/code-server-lib/src/main/resources/application.yml +++ b/packages/code-server/code-server-lib/src/main/resources/application.yml @@ -2,7 +2,7 @@ spring: mvc.pathmatch.matching-strategy: ant_path_matcher application: name: dna-codeserver-service - version: 1.2.9 + version: 1.2.10 profile: active: production @@ -96,6 +96,7 @@ codeServer: run.collab.admin: ${RUN_COLLAB_ADMIN:YOUR_COLLAB_BOOLEAN} collab.pid: ${COLLAB_PID:YOUR_COLLAB_PID} vault.baseuri: ${CODE_SERVER_VAULT_BASEURI:XXXX} + collab.adminbypass.projectname: ${COLLAB_BYPASS_PROJECTNAME:YOUR_PROJECT_NAME} codespace.filename: ${CODESPACE_FILE_NAME:YOUR_CODESPACE_FILE_NAME} swagger.headers.authorization.token: ${SWAGGER_HEADER_AUTH:XXXXXX}