Skip to content

Commit b699ee8

Browse files
author
runzexia
committed
could read logs & event if haven extend_read permission
Signed-off-by: runzexia <[email protected]>
1 parent bd4727b commit b699ee8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesComputer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void taskCompletedWithProblems(Executor executor, Queue.Task task, long d
7070

7171
@Exported
7272
public List<Container> getContainers() throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException {
73-
if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
73+
if(!Jenkins.get().hasPermission(Computer.EXTENDED_READ)) {
7474
LOGGER.log(Level.FINE, " Computer {0} getContainers, lack of admin permission, returning empty list", this);
7575
return Collections.emptyList();
7676
}
@@ -91,7 +91,7 @@ public List<Container> getContainers() throws UnrecoverableKeyException, Certifi
9191

9292
@Exported
9393
public List<Event> getPodEvents() throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException {
94-
if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
94+
if(!Jenkins.get().hasPermission(Computer.EXTENDED_READ)) {
9595
LOGGER.log(Level.FINE, " Computer {0} getPodEvents, lack of admin permission, returning empty list", this);
9696
return Collections.emptyList();
9797
}
@@ -125,7 +125,7 @@ public List<Event> getPodEvents() throws UnrecoverableKeyException, CertificateE
125125

126126
public void doContainerLog(@QueryParameter String containerId,
127127
StaplerRequest req, StaplerResponse rsp) throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException {
128-
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
128+
Jenkins.get().checkPermission(Computer.EXTENDED_READ);
129129

130130
ByteBuffer outputStream = new ByteBuffer();
131131
KubernetesSlave slave = getNode();

0 commit comments

Comments
 (0)