提交 15f49055 编写于 作者: K kohsuke

started implementing configuration screen.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6400 71c3de6d-444a-0410-be80-ed276b4c234a
上级 16fb103a
......@@ -50,12 +50,18 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy {
return this;
}
public boolean hasPermission(String sid, Permission p) {
Set<String> set = grantedPermissions.get(p);
if(set==null) return false;
return set.contains(sid);
}
private final class AclImpl extends SidACL {
protected Boolean hasPermission(Sid p, Permission permission) {
Set<String> set = grantedPermissions.get(permission);
if(set==null) return null;
if(set.contains(toString(p))) return true;
if(GlobalMatrixAuthorizationStrategy.this.hasPermission(toString(p),permission))
return true;
return null;
}
private String toString(Sid p) {
......@@ -145,7 +151,9 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy {
}
public List<Group> getAllGroups() {
return Permission.getAllGroups();
List<Group> groups = new ArrayList<Group>(Permission.getAllGroups());
groups.remove(Permission.getGroup(Permission.class));
return groups;
}
}
}
......
<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">
<f:block>
<table>
<f:block xmlns:local="local">
<j:set var="groups" value="${descriptor.allGroups}"/>
<d:taglib uri="local">
<!-- generate one row for the sid name @sid -->
<d:tag name="row">
<td style="text-align:left">${sid}</td>
<j:forEach var="g" items="${groups}">
<j:forEach var="p" items="${g.permissions}">
<td>
<f:checkbox name="${p.id}" checked="${it.hasPermission(sid,p)}"/>
</td>
</j:forEach>
</j:forEach>
</d:tag>
</d:taglib>
<table class="center-align">
<!-- The first row will show grouping -->
<tr>
<th />
<j:forEach var="g" items="${descriptor.allGroups}">
<th>
<j:forEach var="g" items="${groups}">
<th colspan="${g.size()}">
${g.owner.name}
</th>
</j:forEach>
</tr>
<!-- The second row for individual permission -->
<tr>
<th />
<j:forEach var="g" items="${groups}">
<j:forEach var="p" items="${g.permissions}">
<th>
${p.name}
</th>
</j:forEach>
</j:forEach>
</tr>
<tr name="anonymous">
<local:row sid="anonymous" />
</tr>
<!-- template row to be used for adding a new row -->
<j:var set="id" value="${h.generateId()}"/>
<tr id="${id}" style="display:none">
<local:row sid="${null}" />
</tr>
</table>
<div>
User/group to add:
<input type="text" id="${id}text" />
<input type="button" value="Add" id="${id}button"/>
</div>
<script>
makeButton("${id}button", function (e) {
var master = document.getElementById('${id}');
var copy = document.importNode(master,true);
copy.removeAttribute("id");
copy.removeAttribute("style");
copy.firstChild.innerHTML = $$('${id}text').value;
master.parentNode.appendChild(copy);
});
</script>
</f:block>
</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.
先完成此消息的编辑!
想要评论请 注册