Skip to content

Commit

Permalink
Merge pull request #88 from jpederzolli/master
Browse files Browse the repository at this point in the history
 [FIXED JENKINS-30577] Performance fix when determining view permissions
  • Loading branch information
dalvizu committed Dec 8, 2016
2 parents 1769711 + e5c6ae4 commit 35e105f
Showing 1 changed file with 13 additions and 3 deletions.
Expand Up @@ -999,8 +999,7 @@ public boolean hasPermission(final Permission p) {
boolean display = true;
//tester la liste vide seulement en lecture
if (READ.name.equals(p.name)) {
final Collection<TopLevelItem> items = this.getItems();
if (items == null || items.isEmpty()) {
if (isEmpty()) {
display = false;
}
} else {
Expand All @@ -1009,5 +1008,16 @@ public boolean hasPermission(final Permission p) {
}

return display;
}
}

/**
* determine if this view is empty
* @return true if this view contains zero items
*/
private boolean isEmpty() {
if (noOfDisplayedBuilds == null || gridBuilder == null) {
return true;
}
return gridBuilder.build(this).isEmpty();
}
}

0 comments on commit 35e105f

Please sign in to comment.