提交 4b0c3b07 编写于 作者: K kohsuke

[FIXED HUDSON-3116] Fixed in 1.288 with a regression test case.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15951 71c3de6d-444a-0410-be80-ed276b4c234a
上级 695ad773
......@@ -121,22 +121,24 @@ public class AuthorizationMatrixProperty extends JobProperty<Job<?, ?>> {
@Override
public JobProperty<?> newInstance(StaplerRequest req,
JSONObject formData) throws FormException {
boolean useProjectSecurity = formData.has("useProjectSecurity");
AuthorizationMatrixProperty amp = new AuthorizationMatrixProperty();
amp.setUseProjectSecurity(useProjectSecurity);
for (Map.Entry<String, Object> r : (Set<Map.Entry<String, Object>>) formData
.getJSONObject("data").entrySet()) {
String sid = r.getKey();
if (r.getValue() instanceof JSONObject) {
for (Map.Entry<String, Boolean> e : (Set<Map.Entry<String, Boolean>>) ((JSONObject) r
.getValue()).entrySet()) {
if (e.getValue()) {
Permission p = Permission.fromId(e.getKey());
amp.add(p, sid);
}
}
}
}
AuthorizationMatrixProperty amp = new AuthorizationMatrixProperty();
formData = formData.getJSONObject("useProjectSecurity");
if(!formData.isNullObject()) {
amp.setUseProjectSecurity(true);
for (Map.Entry<String, Object> r : (Set<Map.Entry<String, Object>>) formData.getJSONObject("data").entrySet()) {
String sid = r.getKey();
if (r.getValue() instanceof JSONObject) {
for (Map.Entry<String, Boolean> e : (Set<Map.Entry<String, Boolean>>) ((JSONObject) r
.getValue()).entrySet()) {
if (e.getValue()) {
Permission p = Permission.fromId(e.getKey());
amp.add(p, sid);
}
}
}
}
}
return amp;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册