提交 1111976a 编写于 作者: K kohsuke

added a syntax to prevent '.' escape. (#1227)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7224 71c3de6d-444a-0410-be80-ed276b4c234a
上级 844eff64
......@@ -187,7 +187,7 @@ public class GlobalMatrixAuthorizationStrategy extends AuthorizationStrategy {
String sid = r.getKey();
for(Map.Entry<String,Boolean> e : (Set<Map.Entry<String,Boolean>>)r.getValue().entrySet()) {
if(e.getValue()) {
Permission p = Permission.fromId(e.getKey().replace('-','.'));
Permission p = Permission.fromId(e.getKey());
gmas.add(p,sid);
}
}
......
......@@ -8,12 +8,7 @@
<j:forEach var="g" items="${groups}">
<j:forEach var="p" items="${g.permissions}">
<td width="*">
<!--
since '.' is handled in a special way, replace them by '-'
'-' is not a part of Java identifier, so this transformation
doesn't cause ambuguity.
-->
<f:checkbox name="${p.id.replace('.','-')}" checked="${instance.hasPermission(attrs.sid,p)}"/>
<f:checkbox name="[${p.id}]" checked="${instance.hasPermission(attrs.sid,p)}"/>
</td>
</j:forEach>
</j:forEach>
......@@ -53,7 +48,7 @@
</tr>
<j:forEach var="sid" items="${instance.allSIDs}">
<tr name="${sid}">
<tr name="[${sid}]">
<local:row title="${sid}" sid="${sid}"/>
</tr>
</j:forEach>
......@@ -96,7 +91,7 @@
copy.removeAttribute("id");
copy.removeAttribute("style");
copy.firstChild.innerHTML = name;
copy.setAttribute("name",name);
copy.setAttribute("name",'['+name+']');
table.appendChild(copy);
Behaviour.applySubtree(findAncestor(table,"TABLE"));
});
......
......@@ -955,8 +955,12 @@ function buildFormTree(form) {
var doms = []; // DOMs that we added 'formDom' for.
doms.push(form);
// abc.def.ghi -> ghi
function shortenName(name) {
// [abc.def.ghi] -> abc.def.ghi
if(name.startsWith('['))
return name.substring(1,name.length-1);
// abc.def.ghi -> ghi
var idx = name.lastIndexOf('.');
if(idx>=0) name = name.substring(idx+1);
return name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册