Skip to content

Commit

Permalink
[FIXED JENKINS-31649] Check should be against AccessControlled and Pe…
Browse files Browse the repository at this point in the history
…rmission.READ

- The previous check was to narrow.
- We now check on AccessControlled (which is implemented by Item)
- We now also check on Permission.READ (which is the generic read permission)

This should allow subtasks who's task may not be an Item to at least implement AccessControlled to alow visibility.

There remains an open question as to whether tasks that are not AccessControlled should ever be visible in the UI

(cherry picked from commit cf1fdf9)
  • Loading branch information
stephenc authored and olivergondza committed Nov 25, 2015
1 parent 0056b55 commit b51653d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/hudson/model/Queue.java
Expand Up @@ -800,8 +800,9 @@ public Item[] getItems() {
}

private List<Item> filterItemListBasedOnPermissions(List<Item> r, Item t) {
if (t.task instanceof hudson.model.Item) {
if (((hudson.model.Item)t.task).hasPermission(hudson.model.Item.READ)) {
if (t.task instanceof hudson.security.AccessControlled) {
if (((hudson.security.AccessControlled)t.task).hasPermission(hudson.model.Item.READ)
|| ((hudson.security.AccessControlled) t.task).hasPermission(hudson.security.Permission.READ)) {
r.add(t);
}
}
Expand Down

0 comments on commit b51653d

Please sign in to comment.