提交 936fb569 编写于 作者: C CloudBees DEV@Cloud

Merge commit 'ca3b5951'

......@@ -145,11 +145,24 @@ public class AnnotatedLargeText<T> extends LargeText {
return super.writeLogTo(start,w);
}
/**
* Strips annotations using a {@link PlainTextConsoleOutputStream}.
* @inheritDoc
*/
@Override
public long writeLogTo(long start, OutputStream out) throws IOException {
return super.writeLogTo(start, new PlainTextConsoleOutputStream(out));
}
/**
* Calls {@link LargeText#writeLogTo(long, OutputStream)} without stripping annotations as {@link #writeLogTo(long, OutputStream)} would.
* @inheritDoc
* @since 1.577
*/
public long writeRawLogTo(long start, OutputStream out) throws IOException {
return super.writeLogTo(start, out);
}
public long writeHtmlTo(long start, Writer w) throws IOException {
ConsoleAnnotationOutputStream caw = new ConsoleAnnotationOutputStream(
w, createAnnotator(Stapler.getCurrentRequest()), context, charset);
......
......@@ -1191,11 +1191,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
public void checkAbortPermission() {
checkPermission(AbstractProject.ABORT);
checkPermission(CANCEL);
}
public boolean hasAbortPermission() {
return hasPermission(AbstractProject.ABORT);
return hasPermission(CANCEL);
}
/**
......@@ -2175,7 +2175,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
private static final Logger LOGGER = Logger.getLogger(AbstractProject.class.getName());
/**
* Permission to abort a build
* @deprecated Just use {@link #CANCEL}.
*/
public static final Permission ABORT = CANCEL;
......
......@@ -226,6 +226,7 @@ public interface Item extends PersistenceRoot, SearchableModelObject, AccessCont
Permission READ = new Permission(PERMISSIONS, "Read", Messages._Item_READ_description(), Permission.READ, PermissionScope.ITEM);
Permission DISCOVER = new Permission(PERMISSIONS, "Discover", Messages._AbstractProject_DiscoverPermission_Description(), Permission.READ, PermissionScope.ITEM);
Permission EXTENDED_READ = new Permission(PERMISSIONS,"ExtendedRead", Messages._AbstractProject_ExtendedReadPermission_Description(), CONFIGURE, Boolean.getBoolean("hudson.security.ExtendedReadPermission"), new PermissionScope[]{PermissionScope.ITEM});
// TODO the following really belong in Job, not Item, but too late to move since the owner.name is encoded in the ID:
Permission BUILD = new Permission(PERMISSIONS, "Build", Messages._AbstractProject_BuildPermission_Description(), Permission.UPDATE, PermissionScope.ITEM);
Permission WORKSPACE = new Permission(PERMISSIONS, "Workspace", Messages._AbstractProject_WorkspacePermission_Description(), Permission.READ, PermissionScope.ITEM);
Permission WIPEOUT = new Permission(PERMISSIONS, "WipeOut", Messages._AbstractProject_WipeOutPermission_Description(), null, Functions.isWipeOutPermissionEnabled(), new PermissionScope[]{PermissionScope.ITEM});
......
......@@ -1205,6 +1205,7 @@ public class Queue extends ResourceController implements Saveable {
/**
* Works just like {@link #checkAbortPermission()} except it indicates the status by a return value,
* instead of exception.
* Also used by default for {@link hudson.model.Queue.Item#hasCancelPermission}.
*/
boolean hasAbortPermission();
......@@ -1478,7 +1479,11 @@ public class Queue extends ResourceController implements Saveable {
}
return s.toString();
}
/**
* Checks whether a scheduled item may be canceled.
* @return by default, the same as {@link hudson.model.Queue.Task#hasAbortPermission}
*/
public boolean hasCancelPermission() {
return task.hasAbortPermission();
}
......
......@@ -25,7 +25,6 @@
package jenkins.model;
import hudson.Util;
import static hudson.model.AbstractProject.ABORT;
import hudson.model.Action;
import hudson.model.BuildableItem;
import hudson.model.Cause;
......@@ -206,7 +205,7 @@ public abstract class ParameterizedJobMixIn<JobT extends Job<JobT, RunT> & Param
*/
@RequirePOST
public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
asJob().checkPermission(ABORT);
asJob().checkPermission(Item.CANCEL);
Jenkins.getInstance().getQueue().cancel(asJob());
rsp.forwardToPreviousPage(req);
}
......
......@@ -70,7 +70,7 @@ AbstractProject.DiscoverPermission.Description=\
AbstractProject.WipeOutPermission.Description=\
This permission grants the ability to wipe out the contents of a workspace.
AbstractProject.CancelPermission.Description=\
This permission grants the ability to cancel a build.
This permission grants the ability to cancel a scheduled, or abort a running, build.
AbstractProject.AssignedLabelString.InvalidBooleanExpression=\
Invalid boolean expression: {0}
AbstractProject.AssignedLabelString.NoMatch=\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册