diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 5642d37c9d7f78f320295c5fca7766ff0ef4f98f..d04b213b1f6daa3e972d085af2d1214c7d910a0d 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 86ad511f03747d2c731d96767ebf7856cbfaf805..e8068f8bf80933a11297fc19d3eef962417b06ec 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 94a13acb36de51f00f8a94a119894260596288ba..d9a383a6571eedb5e8e51d36f48fe99e7f261c96 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 193c67a3e53b653ff7f690668c06fad7edd5c5fe..f6c24a721e12dbe3326d4e56aa9049dbd927828a 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 +