Skip to content

Commit

Permalink
movements example from sword-examples working correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanmansum committed Dec 9, 2024
1 parent 12471a4 commit 3aa84dd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface DansBagMappingService {

EditFiles getEditFilesFromDansDeposit(DansBagDeposit dansDeposit, String updatesDataset);

EditPermissions getEditPermissionsFromDansDeposit(DansBagDeposit dansDeposit);
EditPermissions getEditPermissionsFromDansDeposit(DansBagDeposit dansDeposit, String updatesDataset);

String packageOriginalMetadata(DansBagDeposit dansDeposit) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,19 @@ public EditFiles getEditFilesFromDansDeposit(DansBagDeposit dansDeposit, String
}

@Override
public EditPermissions getEditPermissionsFromDansDeposit(DansBagDeposit dansDeposit) {
var userId = dansDeposit.getDepositorUserId();
var editPermissions = new EditPermissions();
var roleAssignment = new RoleAssignment();
roleAssignment.setAssignee("@" + userId);
roleAssignment.setRole("contributorplus"); // TODO: make this configurable
editPermissions.setAddRoleAssignments(List.of(roleAssignment));
return editPermissions;
public EditPermissions getEditPermissionsFromDansDeposit(DansBagDeposit dansDeposit, String updatesDataset) {
if (updatesDataset == null) {
var userId = dansDeposit.getDepositorUserId();
var editPermissions = new EditPermissions();
var roleAssignment = new RoleAssignment();
roleAssignment.setAssignee("@" + userId);
roleAssignment.setRole("contributorplus"); // TODO: make this configurable
editPermissions.setAddRoleAssignments(List.of(roleAssignment));
return editPermissions;
}
else {
return new EditPermissions();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void run() throws IOException {
var editFiles = mappingService.getEditFilesFromDansDeposit(dansDeposit, updatesDataset);
yamlService.writeYaml(new EditFilesRoot(editFiles), dansDeposit.getBagDir().resolve("edit-files.yml"));

var editPermissions = mappingService.getEditPermissionsFromDansDeposit(dansDeposit);
var editPermissions = mappingService.getEditPermissionsFromDansDeposit(dansDeposit, updatesDataset);
yamlService.writeYaml(new EditPermissionsRoot(editPermissions), dansDeposit.getBagDir().resolve("edit-permissions.yml"));

var updateState = new UpdateState();
Expand Down

0 comments on commit 3aa84dd

Please sign in to comment.