Skip to content
Permalink
Browse files
[FIXED JENKINS-13223]
  • Loading branch information
jacob_robertson committed Mar 26, 2012
1 parent 3d3a3b7 commit 2509535f7799e2821cdf8f8569762d742f22e6c7
Showing with 52 additions and 0 deletions.
  1. +47 −0 src/main/java/hudson/views/SecuredJobsFilter.java
  2. +5 −0 src/main/webapp/secured-jobs-help.html
@@ -0,0 +1,47 @@
package hudson.views;

import hudson.Extension;
import hudson.model.JobProperty;
import hudson.model.TopLevelItem;
import hudson.model.Descriptor;
import hudson.model.Job;
import hudson.security.AuthorizationMatrixProperty;

import org.kohsuke.stapler.DataBoundConstructor;

/**
* Simply filters on whether a job is secured through the "Project-based Matrix Authorization Strategy".
*
* @author jacob
*/
public class SecuredJobsFilter extends AbstractIncludeExcludeJobFilter {

@DataBoundConstructor
public SecuredJobsFilter(String includeExcludeTypeString) {
super(includeExcludeTypeString);
}

@SuppressWarnings({ "rawtypes", "unchecked" })
protected boolean matches(TopLevelItem item) {
if (item instanceof Job) {
Job job = (Job) item;
JobProperty prop = job.getProperty(AuthorizationMatrixProperty.class);
return (prop != null);
} else {
return false;
}
}

@Extension
public static class DescriptorImpl extends Descriptor<ViewJobFilter> {
@Override
public String getDisplayName() {
return "Project-based Secured Jobs";
}
@Override
public String getHelpFile() {
return "/plugin/view-job-filters/secured-jobs-help.html";
}
}

}
@@ -0,0 +1,5 @@
<div>
Filters on whether a job has selected the "Enable project-based security" option.
<br/><br/>
<b>NOTE:</b> This filter does not <u>provide</u> security - it merely provides convenient views that feed off of the security you've already set up.
</div>

0 comments on commit 2509535

Please sign in to comment.