diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 5642d37c9d..d04b213b1f 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -489,8 +489,25 @@ public class Functions { return hasPermission(Hudson.getInstance(),permission); } - public static boolean hasPermission(AccessControlled object, Permission permission) throws IOException, ServletException { - return permission==null || object.hasPermission(permission); + /** + * This version is so that the 'hasPermission' can degrade gracefully + * if "it" is not an {@link AccessControlled} object. + */ + public static boolean hasPermission(Object object, Permission permission) throws IOException, ServletException { + if (permission == null) + return true; + if (object instanceof AccessControlled) + return ((AccessControlled)object).hasPermission(permission); + else { + List ancs = Stapler.getCurrentRequest().getAncestors(); + for(Ancestor anc : Iterators.reverse(ancs)) { + Object o = anc.getObject(); + if (o instanceof AccessControlled) { + return ((AccessControlled)o).hasPermission(permission); + } + } + return Hudson.getInstance().hasPermission(permission); + } } public static void adminCheck(StaplerRequest req, StaplerResponse rsp, Object required, Permission permission) throws IOException, ServletException { diff --git a/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java b/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java index 86ad511f03..e8068f8bf8 100644 --- a/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java +++ b/core/src/main/java/hudson/security/AuthorizationMatrixProperty.java @@ -5,9 +5,9 @@ import hudson.model.Job; import hudson.model.JobProperty; import hudson.model.JobPropertyDescriptor; import hudson.model.Hudson; +import hudson.model.Run; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -136,7 +136,7 @@ public class AuthorizationMatrixProperty extends JobProperty> { } public List getAllGroups() { - return Collections.singletonList(PermissionGroup.get(Item.class)); + return Arrays.asList(PermissionGroup.get(Item.class),PermissionGroup.get(Run.class)); } public boolean showPermission(Permission p) { diff --git a/core/src/main/resources/hudson/model/AbstractBuild/index.jelly b/core/src/main/resources/hudson/model/AbstractBuild/index.jelly index 94a13acb36..d9a383a657 100644 --- a/core/src/main/resources/hudson/model/AbstractBuild/index.jelly +++ b/core/src/main/resources/hudson/model/AbstractBuild/index.jelly @@ -3,12 +3,12 @@
- + - - + + - +
${%startedAgo(it.timestampString)}
@@ -125,4 +125,4 @@ - \ No newline at end of file + diff --git a/core/src/main/resources/lib/hudson/summary.jelly b/core/src/main/resources/lib/hudson/summary.jelly index 193c67a3e5..f6c24a721e 100644 --- a/core/src/main/resources/lib/hudson/summary.jelly +++ b/core/src/main/resources/lib/hudson/summary.jelly @@ -13,7 +13,7 @@ Attributes: permission object. If specified, the link will be displayed only if you have a permission --> - + @@ -30,4 +30,4 @@ Attributes: - \ No newline at end of file +