Skip to content

Commit a9a4306

Browse files
committed
register perms at start up
1 parent 99d2978 commit a9a4306

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/hudson/plugins/promoted_builds/Promotion.java

+14
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
import org.kohsuke.stapler.StaplerRequest;
5858
import org.kohsuke.stapler.StaplerResponse;
5959

60+
import hudson.init.InitMilestone;
61+
import hudson.init.Initializer;
62+
import org.kohsuke.accmod.restrictions.DoNotUse;
63+
6064
/**
6165
* Records a promotion process.
6266
*
@@ -486,6 +490,16 @@ private boolean preBuild(BuildListener listener, List<BuildStep> steps) {
486490
public static final PermissionGroup PERMISSIONS = new PermissionGroup(Promotion.class, Messages._Promotion_Permissions_Title());
487491
public static final Permission PROMOTE = new Permission(PERMISSIONS, "Promote", Messages._Promotion_PromotePermission_Description(), Jenkins.ADMINISTER, PermissionScope.RUN);
488492

493+
@Initializer(before = InitMilestone.SYSTEM_CONFIG_LOADED)
494+
@Restricted(DoNotUse.class)
495+
public static void registerPermissions() {
496+
// Pending JENKINS-17200, ensure that the above permissions have been registered prior to
497+
// allowing plugins to adapt the system configuration, which may depend on these permissions
498+
// having been registered. Since this method is static and since it follows the above
499+
// construction of static permission objects (and therefore their calls to
500+
// PermissionGroup#register), there is nothing further to do in this method.
501+
}
502+
489503
@Override
490504
public int hashCode() {
491505
return this.getId().hashCode();

0 commit comments

Comments
 (0)