Skip to content

Commit

Permalink
register perms at start up
Browse files Browse the repository at this point in the history
  • Loading branch information
pash-slack committed Jun 27, 2022
1 parent 99d2978 commit a9a4306
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/hudson/plugins/promoted_builds/Promotion.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import hudson.init.InitMilestone;
import hudson.init.Initializer;
import org.kohsuke.accmod.restrictions.DoNotUse;

/**
* Records a promotion process.
*
Expand Down Expand Up @@ -486,6 +490,16 @@ private boolean preBuild(BuildListener listener, List<BuildStep> steps) {
public static final PermissionGroup PERMISSIONS = new PermissionGroup(Promotion.class, Messages._Promotion_Permissions_Title());
public static final Permission PROMOTE = new Permission(PERMISSIONS, "Promote", Messages._Promotion_PromotePermission_Description(), Jenkins.ADMINISTER, PermissionScope.RUN);

@Initializer(before = InitMilestone.SYSTEM_CONFIG_LOADED)
@Restricted(DoNotUse.class)
public static void registerPermissions() {
// Pending JENKINS-17200, ensure that the above permissions have been registered prior to
// allowing plugins to adapt the system configuration, which may depend on these permissions
// having been registered. Since this method is static and since it follows the above
// construction of static permission objects (and therefore their calls to
// PermissionGroup#register), there is nothing further to do in this method.
}

@Override
public int hashCode() {
return this.getId().hashCode();
Expand Down

0 comments on commit a9a4306

Please sign in to comment.