Skip to content

Commit

Permalink
fix bug from IQSS#9257 which changed return type to FAR from DataFile
Browse files Browse the repository at this point in the history
seen in the Edit Permissions/File dialog when clicking the link with the
# of files listed. In that dialog, things explode trying to get the
directoryLabel of a FileAccessRequest (seen in log) and the popup dialog
incorrectly shows the input to select a user, only has a grant button
(no reject), and doesn't work (the last could be an issue with this
branch only).
  • Loading branch information
qqmyers committed Jul 7, 2023
1 parent c07e960 commit 6016581
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.event.ActionEvent;
Expand Down Expand Up @@ -89,6 +91,15 @@ public class ManageFilePermissionsPage implements java.io.Serializable {
public TreeMap<AuthenticatedUser, List<FileAccessRequest>> getFileAccessRequestMap() {
return fileAccessRequestMap;
}

public List<DataFile> getDataFilesForRequestor() {
List<FileAccessRequest> fars = fileAccessRequestMap.get(getFileRequester());
if (fars == null) {
return new ArrayList<>();
} else {
return fars.stream().map(FileAccessRequest::getDataFile).collect(Collectors.toList());
}
}

private final TreeMap<AuthenticatedUser,List<FileAccessRequest>> fileAccessRequestMap = new TreeMap<>();
private boolean showDeleted = true;
Expand Down Expand Up @@ -182,13 +193,13 @@ private void initMaps() {

// populate the file access requests map
for (FileAccessRequest fileAccessRequest : file.getFileAccessRequests(FileAccessRequest.RequestState.CREATED)) {
List<FileAccessRequest> requestedFiles = fileAccessRequestMap.get(fileAccessRequest.getRequester());
if (requestedFiles == null) {
requestedFiles = new ArrayList<>();
List<FileAccessRequest> fileAccessRequestList = fileAccessRequestMap.get(fileAccessRequest.getRequester());
if (fileAccessRequestList == null) {
fileAccessRequestList = new ArrayList<>();
AuthenticatedUser withProvider = authenticationService.getAuthenticatedUserWithProvider(fileAccessRequest.getRequester().getUserIdentifier());
fileAccessRequestMap.put(withProvider, requestedFiles);
fileAccessRequestMap.put(withProvider, fileAccessRequestList);
}
requestedFiles.add(fileAccessRequest);
fileAccessRequestList.add(fileAccessRequest);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/permissions-manage-files.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
<o:importFunctions type="java.util.Arrays" />
<p:dataTable id="restrictedFilesForAccess" var="file"
value="#{empty manageFilePermissionsPage.fileRequester ? Arrays:asList(manageFilePermissionsPage.fileMap.keySet().toArray()) :
manageFilePermissionsPage.fileAccessRequestMap.get(manageFilePermissionsPage.fileRequester)}"
manageFilePermissionsPage.dataFilesForRequestor}"
selection="#{manageFilePermissionsPage.selectedFiles}" rowKey="#{file.id}" sortBy="#{file.displayName}"
scrollable="true" scrollHeight="300">

Expand Down

0 comments on commit 6016581

Please sign in to comment.