Skip to content

Commit 8dc0517

Browse files
committed
Remove obsolete trustAdmins parameter and admin override from ApiTokenProperty permission check
1 parent 7c657df commit 8dc0517

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

core/src/main/java/jenkins/security/ApiTokenProperty.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,10 @@ public boolean matchesPassword(String token) {
189189
*/
190190
private boolean hasPermissionToSeeToken() {
191191
// Administrators can do whatever they want
192-
return canCurrentUserControlObject(true, user);
192+
return canCurrentUserControlObject(user);
193193
}
194194

195-
private static boolean canCurrentUserControlObject(boolean trustAdmins, User propertyOwner) {
196-
if (trustAdmins && Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
197-
return true;
198-
}
199-
195+
private static boolean canCurrentUserControlObject(User propertyOwner) {
200196
User current = User.current();
201197
if (current == null) { // Anonymous
202198
return false;
@@ -539,7 +535,7 @@ public boolean mustDisplayLegacyApiToken(User propertyOwner) {
539535
// for Jelly view
540536
@Restricted(NoExternalUse.class)
541537
public boolean hasCurrentUserRightToGenerateNewToken(User propertyOwner) {
542-
return canCurrentUserControlObject(true, propertyOwner);
538+
return canCurrentUserControlObject(propertyOwner);
543539
}
544540

545541
/**

0 commit comments

Comments
 (0)