提交 b3f8f536 编写于 作者: R redsolo

[fixed] Added "View workspace" permission to the matrix based security. (issue #434)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8998 71c3de6d-444a-0410-be80-ed276b4c234a
上级 da529b03
......@@ -922,6 +922,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
* Serves the workspace files.
*/
public void doWs( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, InterruptedException {
checkPermission(AbstractProject.WORKSPACE);
FilePath ws = getWorkspace();
if(!ws.exists()) {
// if there's no workspace, report a nice error message
......@@ -1009,6 +1010,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
private static final Logger LOGGER = Logger.getLogger(AbstractProject.class.getName());
public static final Permission BUILD = new Permission(PERMISSIONS, "Build", Permission.UPDATE);
public static final Permission WORKSPACE = new Permission(PERMISSIONS, "Workspace", Permission.READ);
/**
* Permission to abort a build. For now, let's make it the same as {@link #BUILD}
*/
......
......@@ -14,7 +14,7 @@
${act.displayName}
</t:summary>
</j:forEach>
<t:summary icon="folder.gif" href="ws/">
<t:summary icon="folder.gif" href="ws/" permission="${it.WORKSPACE}">
${%Workspace}
</t:summary>
......
......@@ -8,7 +8,7 @@
${act.displayName}
</t:summary>
</j:forEach>
<t:summary icon="folder.gif" href="ws/">
<t:summary icon="folder.gif" href="ws/" permission="${it.WORKSPACE}">
${%Workspace}
</t:summary>
......
......@@ -13,7 +13,7 @@
<l:task icon="images/24x24/up.gif" href="${rootURL}/" title="${%Back to Dashboard}" />
<l:task icon="images/24x24/search.gif" href="${url}/" title="${%Status}" />
<l:task icon="images/24x24/notepad.gif" href="${url}/changes" title="${%Changes}" />
<l:task icon="images/24x24/folder.gif" href="${url}/ws/" title="${%Workspace}" />
<l:task icon="images/24x24/folder.gif" href="${url}/ws/" title="${%Workspace}" permission="${it.WORKSPACE}" />
<j:if test="${it.configurable}">
<j:if test="${!it.disabled}">
<l:task icon="images/24x24/clock.gif" href="${url}/build?delay=0sec" title="${%Build Now}" onclick="return build(this)" permission="${it.BUILD}" />
......
......@@ -9,21 +9,25 @@ Attributes:
where the summary icon links to.
iconOnly (optional)
if true, hyperlink will only cover the icon, not the body.
permission (optional)
permission object. If specified, the link will be displayed only if you have a permission
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:if test="${attrs.icon!=null}">
<tr>
<td>
<a href="${attrs.href}">
<img src="${h.ifThenElse(icon.startsWith('/'), rootURL+icon, imagesURL+'/48x48/'+icon)}"
width="48" height="48" style="margin-right:1em" />
</a>
</td>
<td style="vertical-align:middle">
<a href="${h.ifThenElse(attrs.iconOnly==null,attrs.href,null)}">
<d:invokeBody />
</a>
</td>
</tr>
<j:if test="${h.hasPermission(attrs.permission)}">
<j:if test="${attrs.icon!=null}">
<tr>
<td>
<a href="${attrs.href}">
<img src="${h.ifThenElse(icon.startsWith('/'), rootURL+icon, imagesURL+'/48x48/'+icon)}"
width="48" height="48" style="margin-right:1em" />
</a>
</td>
<td style="vertical-align:middle">
<a href="${h.ifThenElse(attrs.iconOnly==null,attrs.href,null)}">
<d:invokeBody />
</a>
</td>
</tr>
</j:if>
</j:if>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册