提交 5edc0f17 编写于 作者: K kohsuke

adding a permission check for cancelling a build.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6577 71c3de6d-444a-0410-be80-ed276b4c234a
上级 3e44b225
......@@ -585,7 +585,13 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
return r;
}
}
/**
* People can stop a build if they can start a build.
*/
public void checkAbortPermission() {
getParent().getACL().checkPermission(AbstractProject.BUILD);
}
//
//
......
......@@ -157,9 +157,7 @@ public class Executor extends Thread implements ModelObject {
* Stops the current build.
*/
public void doStop( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
if(!Hudson.adminCheck(req,rsp))
return;
executable.checkAbortPermission();
interrupt();
rsp.forwardToPreviousPage(req);
}
......
......@@ -3,6 +3,7 @@ package hudson.model;
import hudson.Util;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.export.Exported;
import org.acegisecurity.AccessDeniedException;
import hudson.model.Node.Mode;
import hudson.util.OneShotEvent;
......@@ -590,6 +591,14 @@ public class Queue extends ResourceController {
* Called by {@link Executor} to perform the task
*/
void run();
/**
* Checks the permission to see if the current user can abort this executable.
* Returns normally from this method if it's OK.
*
* @throws AccessDeniedException if the permission is not granted.
*/
void checkAbortPermission();
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册