Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<jenkins.baseline>2.528</jenkins.baseline>
<!-- TODO https://github.com/jenkinsci/jenkins/pull/11333 -->
<jenkins.version>2.542-rc37822.b_14a_5941318e</jenkins.version>
Copy link
Member Author

Choose a reason for hiding this comment

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

requires noDefer from jenkinsci/jenkins#11333

<hpi.compatibleSinceVersion>1372</hpi.compatibleSinceVersion>
</properties>

Expand All @@ -91,7 +92,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3482.vc10d4f6da_28a_</version>
<version>5774.v5c6d72f56a_61</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
@Restricted(NoExternalUse.class)
public class ManageCredentialsConfiguration extends ManagementLink {

public String getCategoryName() {
return "SECURITY";
@NonNull
@Override
public Category getCategory() {
Copy link
Member Author

Choose a reason for hiding this comment

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

cleanup while I was here

return Category.SECURITY;

Check warning on line 22 in src/main/java/com/cloudbees/plugins/credentials/ManageCredentialsConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 22 is not covered by tests
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.model.Action;
import hudson.model.Actionable;
import hudson.model.Api;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.model.ManagementLink;
import hudson.model.ModelObject;
import hudson.model.RootAction;
import hudson.model.TopLevelItem;
Expand All @@ -59,6 +62,7 @@
import jenkins.model.TransientActionFactory;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
Expand Down Expand Up @@ -239,24 +243,36 @@
return false;
}

@Restricted(DoNotUse.class) // for jelly
public ManagementLink getManagementLink() {
return ExtensionList.lookupSingleton(ManageCredentialsConfiguration.class);
}

/**
* Administrator's view credentials from 'Manage Jenkins'.
* @param accessControlled an access controlled object.
* @return whether the action should be visible or not if the user is an administrator.
*/
private boolean isVisibleForAdministrator(AccessControlled accessControlled) {
return accessControlled instanceof Jenkins && accessControlled.hasPermission(Jenkins.ADMINISTER);
}

/**
* Expose a Jenkins {@link Api}.
*
* @return the {@link Api}.
*/
public Api getApi() {
return new Api(this);
}

public Actionable getObject() {
Copy link
Member Author

Choose a reason for hiding this comment

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

required for job page re-work

if (context instanceof Actionable actionable) {
return actionable;
}
return null;

Check warning on line 273 in src/main/java/com/cloudbees/plugins/credentials/ViewCredentialsAction.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 248-273 are not covered by tests
}

/**
* Returns the credential entries.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,21 @@
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout"
xmlns:f="/lib/form" xmlns:t="/lib/hudson">
<l:layout title="${it.displayName}" permission="${app.ADMINISTER}">
<st:include it="${app}" page="sidepanel"/>
<l:main-panel>
<h1>${it.displayName}</h1>
<p />
<div class="behavior-loading">${%LOADING}</div>
Copy link
Member Author

Choose a reason for hiding this comment

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

no longer needed as system pages do this by default (noDefer to skip which is needed on ViewCredentialsAction)

<f:form action="configure" method="post" name="config">
<j:set var="instance" value="${it}"/>
<j:set var="descriptor" value="${it.descriptor}"/>
<j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigByDescriptor(it.FILTER)}">
<j:set var="instance" value="${descriptor}"/>
<f:rowSet name="${descriptor.jsonSafeClassName}">
<st:include from="${descriptor}" page="${descriptor.globalConfigPage}"/>
</f:rowSet>
</j:forEach>
<f:bottomButtonBar>
<f:submit value="${%Save}"/>
<f:apply/>
</f:bottomButtonBar>
</f:form>
</l:main-panel>
</l:layout>
<l:settings-subpage permission="${app.ADMINISTER}">
<f:form action="configure" method="post" name="config">
<j:set var="instance" value="${it}"/>
<j:set var="descriptor" value="${it.descriptor}"/>
<j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigByDescriptor(it.FILTER)}">
<j:set var="instance" value="${descriptor}"/>
<f:rowSet name="${descriptor.jsonSafeClassName}">
<st:include from="${descriptor}" page="${descriptor.globalConfigPage}"/>
</f:rowSet>
</j:forEach>
<f:bottomButtonBar>
<f:submit value="${%Save}"/>
<f:apply/>
</f:bottomButtonBar>
</f:form>
</l:settings-subpage>

</j:jelly>
Loading
Loading