Skip to content

Commit 6764838

Browse files
Brinkop Andre (uib05464)scurvydoggo
authored andcommitted
Make agent user permission check type-safe
1 parent afea895 commit 6764838

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main/java/org/jenkinsci/plugins/GithubRequireOrganizationMembershipACL.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
2626
*/
2727
package org.jenkinsci.plugins;
2828

29+
import hudson.model.*;
2930
import org.acegisecurity.Authentication;
3031
import org.jenkinsci.plugins.github_branch_source.GitHubSCMSource;
3132
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
@@ -41,10 +42,6 @@ of this software and associated documentation files (the "Software"), to deal
4142
import edu.umd.cs.findbugs.annotations.NonNull;
4243
import edu.umd.cs.findbugs.annotations.Nullable;
4344

44-
import hudson.model.AbstractItem;
45-
import hudson.model.AbstractProject;
46-
import hudson.model.Describable;
47-
import hudson.model.Item;
4845
import hudson.plugins.git.GitSCM;
4946
import hudson.plugins.git.UserRemoteConfig;
5047
import hudson.security.ACL;
@@ -254,10 +251,10 @@ private boolean checkReadPermission(@NonNull Permission permission) {
254251

255252
private boolean checkAgentUserPermission(@NonNull Permission permission) {
256253
String id = permission.getId();
257-
return (id.equals("hudson.model.Hudson.Read")
258-
|| id.equals("hudson.model.Computer.Create")
259-
|| id.equals("hudson.model.Computer.Connect")
260-
|| id.equals("hudson.model.Computer.Configure"));
254+
return (id.equals(Hudson.READ)
255+
|| id.equals(Computer.CREATE)
256+
|| id.equals(Computer.CONNECT)
257+
|| id.equals(Computer.CONFIGURE));
261258
}
262259

263260
private boolean checkJobStatusPermission(@NonNull Permission permission) {

0 commit comments

Comments
 (0)