Skip to content

Commit 1823668

Browse files
committed
PR comments
1 parent c50fd6e commit 1823668

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTree.java

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ private FileAccessTree(FilesEntitlement filesEntitlement, PathLookup pathLookup,
186186
this.exclusivePaths = sortedExclusivePaths;
187187
this.readPaths = pruneSortedPaths(readPaths).toArray(new String[0]);
188188
this.writePaths = pruneSortedPaths(writePaths).toArray(new String[0]);
189+
190+
logger.debug(
191+
() -> Strings.format(
192+
"Created FileAccessTree with paths: exclusive [%s], read [%s], write [%s]",
193+
String.join(",", this.exclusivePaths),
194+
String.join(",", this.readPaths),
195+
String.join(",", this.writePaths)
196+
)
197+
);
189198
}
190199

191200
// package private for testing
@@ -235,34 +244,14 @@ public static FileAccessTree withoutExclusivePaths(
235244
public boolean canRead(Path path) {
236245
var normalizedPath = normalizePath(path);
237246
var canRead = checkPath(normalizedPath, readPaths);
238-
239-
logger.trace(
240-
() -> Strings.format(
241-
"checking [%s] (normalized to [%s]) against [%s] for READ: %b",
242-
path,
243-
normalizedPath,
244-
String.join(",", readPaths),
245-
canRead
246-
)
247-
);
248-
247+
logger.trace(() -> Strings.format("checking [%s] (normalized to [%s]) for READ: %b", path, normalizedPath, canRead));
249248
return canRead;
250249
}
251250

252251
public boolean canWrite(Path path) {
253252
var normalizedPath = normalizePath(path);
254253
var canWrite = checkPath(normalizedPath, writePaths);
255-
256-
logger.trace(
257-
() -> Strings.format(
258-
"checking [%s] (normalized to [%s]) against [%s] for READ_WRITE: %b",
259-
path,
260-
normalizedPath,
261-
String.join(",", writePaths),
262-
canWrite
263-
)
264-
);
265-
254+
logger.trace(() -> Strings.format("checking [%s] (normalized to [%s]) for READ_WRITE: %b", path, normalizedPath, canWrite));
266255
return canWrite;
267256
}
268257

0 commit comments

Comments
 (0)