Skip to content

Commit

Permalink
Merge branch 'release/34.x'
Browse files Browse the repository at this point in the history
* release/34.x:
  #5129 - Dynamic workflow may kick in for curator when try to view document from non-curator
  #5163 - Slug in exported project is always null
  • Loading branch information
reckart committed Nov 13, 2024
2 parents d859aaa + b233f26 commit a5056fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ protected void onInitialize()
{
super.onInitialize();

var page = (AnnotationPageBase) getPage();
for (var ext : getExtensions()) {
ext.onInitialize((AnnotationPageBase) getPage());
ext.onInitialize(page);
activeExtensions.add(ext.getId());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ private ExportedProject exportProjectToZip(FullProjectExportRequest aRequest,

ExportedProject exProject = new ExportedProject();
exProject.setName(aRequest.getProject().getName());
exProject.setSlug(aRequest.getProject().getSlug());

try {
while (!deque.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package de.tudarmstadt.ukp.inception.workload.dynamic.annotation;

import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.CURATOR;
import static de.tudarmstadt.ukp.clarin.webanno.model.PermissionLevel.MANAGER;
import static de.tudarmstadt.ukp.inception.workload.dynamic.DynamicWorkloadExtension.DYNAMIC_WORKLOAD_MANAGER_EXTENSION_ID;

import java.io.Serializable;
Expand All @@ -30,6 +29,7 @@

import de.tudarmstadt.ukp.clarin.webanno.api.annotation.actionbar.ActionBarExtension;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.page.AnnotationPageBase;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.inception.documents.api.DocumentService;
import de.tudarmstadt.ukp.inception.project.api.ProjectService;
import de.tudarmstadt.ukp.inception.rendering.editorstate.AnnotatorState;
Expand All @@ -56,18 +56,21 @@ public class DynamicWorkflowDocumentNavigationActionBarExtension
private final WorkloadManagementService workloadManagementService;
private final DynamicWorkloadExtension dynamicWorkloadExtension;
private final ProjectService projectService;
private final UserDao userService;

private AnnotatorState annotatorState;

@Autowired
public DynamicWorkflowDocumentNavigationActionBarExtension(DocumentService aDocumentService,
WorkloadManagementService aWorkloadManagementService,
DynamicWorkloadExtension aDynamicWorkloadExtension, ProjectService aProjectService)
DynamicWorkloadExtension aDynamicWorkloadExtension, ProjectService aProjectService,
UserDao aUserService)
{
documentService = aDocumentService;
workloadManagementService = aWorkloadManagementService;
dynamicWorkloadExtension = aDynamicWorkloadExtension;
projectService = aProjectService;
userService = aUserService;
}

@Override
Expand All @@ -86,16 +89,16 @@ public int getPriority()
public boolean accepts(AnnotationPageBase aPage)
{
// #Issue 1813 fix
if (aPage.getModelObject().getProject() == null) {
var project = aPage.getModelObject().getProject();
if (project == null) {
return false;
}

// Curator are excluded from the feature
return DYNAMIC_WORKLOAD_MANAGER_EXTENSION_ID
.equals(workloadManagementService.loadOrCreateWorkloadManagerConfiguration(
aPage.getModelObject().getProject()).getType())
&& !projectService.hasRole(aPage.getModelObject().getUser(),
aPage.getModelObject().getProject(), CURATOR, MANAGER);
var sessionOwner = userService.getCurrentUser();
var workloadConfig = workloadManagementService
.loadOrCreateWorkloadManagerConfiguration(aPage.getModelObject().getProject());
return DYNAMIC_WORKLOAD_MANAGER_EXTENSION_ID.equals(workloadConfig.getType())
&& !projectService.hasRole(sessionOwner, project, CURATOR);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ public DynamicWorkflowActionBarExtension dynamicWorkflowActionBarExtension(
@Bean
public DynamicWorkflowDocumentNavigationActionBarExtension dynamicWorkflowDocumentNavigationActionBarExtension(
DocumentService aDocumentService, WorkloadManagementService aWorkloadManagementService,
DynamicWorkloadExtension aDynamicWorkloadExtension, ProjectService aProjectService)
DynamicWorkloadExtension aDynamicWorkloadExtension, ProjectService aProjectService,
UserDao aUserService)
{
return new DynamicWorkflowDocumentNavigationActionBarExtension(aDocumentService,
aWorkloadManagementService, aDynamicWorkloadExtension, aProjectService);
aWorkloadManagementService, aDynamicWorkloadExtension, aProjectService,
aUserService);
}
}

0 comments on commit a5056fc

Please sign in to comment.