Skip to content

Commit 83f1994

Browse files
committed
make docs folder visible to everyone
1 parent 01ae901 commit 83f1994

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

knowage-api/src/main/java/it/eng/knowage/resourcemanager/service/impl/ResourceManagerAPIImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class ResourceManagerAPIImpl implements ResourceManagerAPI {
7878
private static final String METADATA_JSON = "metadata.json";
7979
private static final String MODELS = "models";
8080
private static final Logger LOGGER = Logger.getLogger(ResourceManagerAPIImpl.class);
81+
private static final String DOCS_FOLDER = "docs";
8182
private static Map<String, List<String>> foldersForDevs = new HashMap<>();
8283
private final Map<String, HashMap<String, Object>> cachedNodesInfo = new HashMap<>();
8384

@@ -165,16 +166,16 @@ private FolderDTO createTree(FolderDTO parentFolder, SpagoBIUserProfile profile,
165166
canSee = false;
166167
}
167168
}
168-
if (nodeFile.isDirectory() && canSee(nodePath, profile)) {
169+
if (nodeFile.isDirectory()) {
169170
String[] subNote = nodeFile.list();
170171
for (String fileName : subNote) {
171172
Path path = nodePath.resolve(fileName);
172-
if (path.getParent().equals(workDir)) {
173+
if (path.getParent().equals(workDir) && !fileName.equals(DOCS_FOLDER)) {
173174
if (!canSee(path, profile)) {
174175
continue;
175176
}
176177
}
177-
if (Files.isDirectory(path)) {
178+
if (Files.isDirectory(path) && (fileName.equals(DOCS_FOLDER) || currentRelativePath.startsWith(DOCS_FOLDER) || canSee)) {
178179
FolderDTO folder = new FolderDTO(path);
179180
folder.setKey(hmacUtilities.getKeyHashedValue(path.toString()));
180181

@@ -333,7 +334,7 @@ public Path getDownloadFilePath(List<String> path, SpagoBIUserProfile profile, b
333334
String pathFile = path.get(0);
334335
Path workDirr = getFullRootByPath(pathFile, profile);
335336

336-
if (canSee(workDirr, profile)) {
337+
if (pathFile.startsWith(DOCS_FOLDER) || canSee(workDirr, profile)) {
337338
Path workDir = getWorkDirectory(profile);
338339
pathToReturn = workDir.resolve(pathFile);
339340
}

0 commit comments

Comments
 (0)