diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 87edf95188e1cf69b884fe09a2ac970eaaf6fa6f..4b08a8d92b96d25ebf991daa2e1682ff61162328 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -2,7 +2,7 @@ * The MIT License * * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, - * Yahoo! Inc., Stephen Connolly, Tom Huybrechts, Alan Harder + * Yahoo! Inc., Stephen Connolly, Tom Huybrechts, Alan Harder, Romain Seguy * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -1266,4 +1266,20 @@ public class Functions { public static boolean getIsUnitTest() { return Main.isUnitTest; } + + /** + * Returns {@code true} if the {@link Run#ARTIFACTS} permission is enabled, + * {@code false} otherwise. + * + *
When the {@link Run#ARTIFACTS} permission is not turned on using the + * {@code hudson.security.ArtifactsPermission}, this permission must not be + * considered to be set to {@code false} for every user. It must rather be + * like if the permission doesn't exist at all (which means that every user + * has to have an access to the artifacts but the permission can't be + * configured in the security screen). Got it?
+ */ + public static boolean isArtifactsPermissionEnabled() { + return Boolean.getBoolean("hudson.security.ArtifactsPermission"); + } + } diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index c92b7880da4229face0e1126838ece38e9317e51..e90404c374aed4f27b6383d815b955342d9d2755 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -2,7 +2,7 @@ * The MIT License * * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, - * Daniel Dyer, Red Hat, Inc., Tom Huybrechts + * Daniel Dyer, Red Hat, Inc., Tom Huybrechts, Romain Seguy * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,6 +24,7 @@ */ package hudson.model; +import hudson.Functions; import hudson.AbortException; import hudson.BulkChange; import hudson.EnvVars; @@ -1530,6 +1531,9 @@ public abstract class Run