mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
added a convenience method to check the user membership of a project/build.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7509 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
2b065e8dc8
commit
6c31bc9699
2 files changed
+26
-5
No files matched your search
@@ -1,11 +1,10 @@
|
||||
package hudson.model;
|
||||
|
||||
import hudson.Functions;
|
||||
import hudson.Launcher;
|
||||
import hudson.Proc.LocalProc;
|
||||
import hudson.Util;
|
||||
import hudson.Functions;
|
||||
import hudson.matrix.MatrixConfiguration;
|
||||
import hudson.matrix.MatrixRun;
|
||||
import hudson.maven.MavenBuild;
|
||||
import hudson.model.Fingerprint.BuildPtr;
|
||||
import hudson.model.Fingerprint.RangeSet;
|
||||
@@ -23,9 +22,9 @@ import hudson.tasks.Publisher;
|
||||
import hudson.tasks.test.AbstractTestResultAction;
|
||||
import hudson.util.AdaptedIterator;
|
||||
import hudson.util.Iterators;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.Stapler;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@@ -45,8 +44,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import sun.misc.Request;
|
||||
|
||||
/**
|
||||
* Base implementation of {@link Run}s that build software.
|
||||
*
|
||||
@@ -185,6 +182,18 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this user has made a commit to this build.
|
||||
*
|
||||
* @since 1.191
|
||||
*/
|
||||
public boolean hasParticipant(User user) {
|
||||
for (ChangeLogSet.Entry e : getChangeSet())
|
||||
if(e.getAuthor()==user)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract class AbstractRunner implements Runner {
|
||||
/**
|
||||
* Since configuration can be changed while a build is in progress,
|
||||
|
||||
@@ -613,6 +613,18 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this user has made a commit to this project.
|
||||
*
|
||||
* @since 1.191
|
||||
*/
|
||||
public boolean hasParticipant(User user) {
|
||||
for( R build = getLastBuild(); build!=null; build=build.getPreviousBuild())
|
||||
if(build.hasParticipant(user))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public SCM getScm() {
|
||||
return scm;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user