Skip to content

Commit

Permalink
BXC-4691 add service user
Browse files Browse the repository at this point in the history
  • Loading branch information
sharonluong committed Dec 4, 2024
1 parent 4ceb7e0 commit 36180c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ChompbPreIngestService {
private GlobalPermissionEvaluator globalPermissionEvaluator;
private Path baseProjectsPath;
private String serviceKeyPath;
private String serviceUser;
private static final Set<String> VALID_FILENAMES = Set.of("data.json", "data.csv");

/**
Expand All @@ -43,7 +44,7 @@ public String startCropping(AgentPrincipals agent, String projectName, String em
"--action", "velocicroptor",
"-w", baseProjectsPath.resolve(projectName).toAbsolutePath().toString(),
"-k", serviceKeyPath,
"--user", agent.getUsername(),
"--user", serviceUser,
"--email", email);
}

Expand Down Expand Up @@ -130,4 +131,8 @@ public void setBaseProjectsPath(Path baseProjectsPath) {
public void setServiceKeyPath(String serviceKeyPath) {
this.serviceKeyPath = serviceKeyPath;
}

public void setServiceUser(String serviceUser) {
this.serviceUser = serviceUser;
}
}
1 change: 1 addition & 0 deletions web-admin-app/src/main/webapp/WEB-INF/service-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<property name="globalPermissionEvaluator" ref="globalPermissionEvaluator" />
<property name="baseProjectsPath" value="${chompb.projects.basePath}" />
<property name="serviceKeyPath" value="${boxctron.service.key}" />
<property name="serviceUser" value="${boxctron.service.user}" />
</bean>

<bean class="edu.unc.lib.boxc.web.common.view.CDRViewResolver" p:suffix=".jsp">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void setup() {
service = new ChompbPreIngestService();
service.setBaseProjectsPath(tmpFolder);
service.setServiceKeyPath("/path/to/key");
service.setServiceUser("user");
service.setGlobalPermissionEvaluator(globalPermissionEvaluator);
when(agentPrincipals.getPrincipals()).thenReturn(new AccessGroupSetImpl("group"));
when(globalPermissionEvaluator.hasGlobalPermission(any(AccessGroupSet.class), eq(Permission.ingest))).thenReturn(true);
Expand Down

0 comments on commit 36180c3

Please sign in to comment.