提交 6c31bc96 编写于 作者: K kohsuke

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
上级 2b065e8d
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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册