Skip to content

Commit

Permalink
[JENKINS-46652] Check Computer.BUILD permission only on heayweight ta…
Browse files Browse the repository at this point in the history
…sks.
  • Loading branch information
jglick committed Jan 22, 2018
1 parent b550c33 commit 9842a27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Node.java
Expand Up @@ -394,7 +394,7 @@ public CauseOfBlockage canTake(Queue.BuildableItem item) {
}

Authentication identity = item.authenticate();
if (!hasPermission(identity,Computer.BUILD)) {
if (!(item.task instanceof Queue.FlyweightTask) && !hasPermission(identity, Computer.BUILD)) {
// doesn't have a permission
return CauseOfBlockage.fromMessage(Messages._Node_LackingBuildPermission(identity.getName(), getDisplayName()));
}
Expand Down
Expand Up @@ -134,7 +134,7 @@ public boolean canAccept(WorkChunk c) {
if (c.assignedLabel!=null && !c.assignedLabel.contains(node))
return false; // label mismatch

if (!nodeAcl.hasPermission(item.authenticate(), Computer.BUILD))
if (!(item.task instanceof Queue.FlyweightTask) && !nodeAcl.hasPermission(item.authenticate(), Computer.BUILD))
return false; // tasks don't have a permission to run on this node

return true;
Expand Down

0 comments on commit 9842a27

Please sign in to comment.