Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-71183] Fix Build actions anonymization enable UI check #462

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.cloudbees.jenkins.support.actions;

import com.cloudbees.jenkins.support.filter.ContentFilters;
import hudson.Extension;
import hudson.model.Action;
import hudson.model.Run;
import jenkins.model.TransientActionFactory;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundConstructor;

import edu.umd.cs.findbugs.annotations.NonNull;
Expand All @@ -30,6 +33,12 @@ protected String getBundleNameQualifier() {
return "build";
}

@Restricted(NoExternalUse.class) // stapler
Copy link
Member

Choose a reason for hiding this comment

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

(or DoNotUse works)

@SuppressWarnings("unused") // used by Stapler
public boolean isAnonymized() {
return ContentFilters.get().isEnabled();
}

@Extension
public static class Factory extends TransientActionFactory<Run> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
<p>
Click on Generate Bundle to download the Run information in a zip file
</p>
<j:if test="${com.cloudbees.jenkins.support.filter.ContentFilters.get().isEnabled()}">
<j:if test="${it.anonymized}">
<p>
Support bundle anonymization is enabled. View
<a href="${rootURL}/anonymizedMappings">anonymized mappings here</a>, or manage anonymization settings in the
<a href="${rootURL}/configureSecurity">global security</a> under <i>Support Bundle Anonymization</i>.
</p>
</j:if>
<j:if test="${!com.cloudbees.jenkins.support.filter.ContentFilters.get().isEnabled()}">
<j:if test="${!it.anonymized}">
<p class="warning">
Support bundle anonymization is disabled. This can be enabled in the
<a href="${rootURL}/configureSecurity">global security</a> under <i>Support Bundle Anonymization</i>.
Expand Down