Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2502,12 +2502,28 @@ public boolean isPluginJar(URL jarUrl) {
public static boolean FAST_LOOKUP = !SystemProperties.getBoolean(PluginManager.class.getName() + ".noFastLookup");

/** @deprecated in Jenkins 2.222 use {@link Jenkins#ADMINISTER} instead */
@Deprecated
public static final Permission UPLOAD_PLUGINS = new Permission(Jenkins.PERMISSIONS, "UploadPlugins", Messages._PluginManager_UploadPluginsPermission_Description(), Jenkins.ADMINISTER, PermissionScope.JENKINS);
@Deprecated(forRemoval = true)
@Restricted(DoNotUse.class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use @Restricted on a @Deprecated member. These are two different things with different purposes and should not be mixed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 90d00cf

Copy link
Member

@jglick jglick Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, FWIW I meant to keep the @Deprecated and delete the @Restricted. That is, obviously these fields should be @Deprecated; I was asking to not add @Restricted.

(same on RUN_SCRIPTS of course)

Copy link
Member Author

@jtnord jtnord Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I explicitly wanted to break source compatibility :)
its been deprecated for 5 years, devs (outside of the authZ plugins where its use is still semi legitimate) are not paying attention to it today.

public static final Permission UPLOAD_PLUGINS =
new Permission(Jenkins.PERMISSIONS,
"UploadPlugins",
Messages._PluginManager_UploadPluginsPermission_Description(),
null,
false,
new PermissionScope[] { PermissionScope.JENKINS }
);

/** @deprecated in Jenkins 2.222 use {@link Jenkins#ADMINISTER} instead */
@Deprecated
public static final Permission CONFIGURE_UPDATECENTER = new Permission(Jenkins.PERMISSIONS, "ConfigureUpdateCenter", Messages._PluginManager_ConfigureUpdateCenterPermission_Description(), Jenkins.ADMINISTER, PermissionScope.JENKINS);
@Deprecated(forRemoval = true)
@Restricted(DoNotUse.class)
public static final Permission CONFIGURE_UPDATECENTER =
new Permission(Jenkins.PERMISSIONS,
"ConfigureUpdateCenter",
Messages._PluginManager_ConfigureUpdateCenterPermission_Description(),
null,
false,
new PermissionScope[] { PermissionScope.JENKINS }
);

/**
* Remembers why a plugin failed to deploy.
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/jenkins/model/Jenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -5891,8 +5891,9 @@ public boolean shouldShowStackTrace() {

public static final Permission READ = new Permission(PERMISSIONS, "Read", Messages._Hudson_ReadPermission_Description(), Permission.READ, PermissionScope.JENKINS);
/** @deprecated in Jenkins 2.222 use {@link Jenkins#ADMINISTER} instead */
@Deprecated
public static final Permission RUN_SCRIPTS = new Permission(PERMISSIONS, "RunScripts", Messages._Hudson_RunScriptsPermission_Description(), ADMINISTER, PermissionScope.JENKINS);
@Deprecated(forRemoval = true)
@Restricted(DoNotUse.class)
public static final Permission RUN_SCRIPTS = new Permission(PERMISSIONS, "RunScripts", Messages._Hudson_RunScriptsPermission_Description(), null, false, new PermissionScope[] {PermissionScope.JENKINS});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May as well delete localized key while we are here and replace with some text that mentions it is deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the text is already "Deprecated - Please use the Overall/Administer permission instead".
Are you suggesting that we hard code the English message here and remove the translations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it already notes that it is deprecated I guess it does not matter; would just be a tiny bit of tech debt reduction to eliminate a few localizable keys since the values should never be displayed in the GUI any more.


/**
* Urls that are always visible without READ permission.
Expand Down
6 changes: 1 addition & 5 deletions test/src/test/java/jenkins/model/JenkinsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ void testDoScript() throws Exception {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().
grant(Jenkins.ADMINISTER).everywhere().to("alice").
grant(Jenkins.READ).everywhere().to("bob").
grantWithoutImplication(Jenkins.RUN_SCRIPTS, Jenkins.READ).everywhere().to("charlie"));
grant(Jenkins.READ).everywhere().to("bob"));
WebClient wc = j.createWebClient();

wc.withBasicApiToken(User.getById("alice", true));
Expand All @@ -411,9 +410,6 @@ void testDoScript() throws Exception {
wc.withBasicApiToken(User.getById("bob", true));
wc.assertFails("script", HttpURLConnection.HTTP_FORBIDDEN);

//TODO: remove once RUN_SCRIPTS is finally retired
wc.withBasicApiToken(User.getById("charlie", true));
wc.assertFails("script", HttpURLConnection.HTTP_FORBIDDEN);
}

@Test
Expand Down
Loading