提交 27f8c5a6 编写于 作者: K kohsuke

Fixed the serialized form of project-based matrix authorization strategy.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@12421 71c3de6d-444a-0410-be80-ed276b4c234a
上级 716d3c9d
......@@ -3,6 +3,11 @@ package hudson.security;
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.model.Jobs;
import hudson.util.RobustReflectionConverter;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.mapper.Mapper;
import com.thoughtworks.xstream.core.JVM;
/**
* {@link GlobalMatrixAuthorizationStrategy} plus per-project ACL.
......@@ -39,6 +44,32 @@ public class ProjectMatrixAuthorizationStrategy extends GlobalMatrixAuthorizatio
}
};
public static class ConverterImpl extends GlobalMatrixAuthorizationStrategy.ConverterImpl {
private RobustReflectionConverter ref;
public ConverterImpl(Mapper m) {
ref = new RobustReflectionConverter(m,new JVM().bestReflectionProvider());
}
protected GlobalMatrixAuthorizationStrategy create() {
return new GlobalMatrixAuthorizationStrategy();
}
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
String name = reader.peekNextChild();
if(name!=null && name.equals("permission"))
// the proper serialization form
return super.unmarshal(reader, context);
else
// remain compatible with earlier problem where we used reflection converter
return ref.unmarshal(reader,context);
}
public boolean canConvert(Class type) {
return type==ProjectMatrixAuthorizationStrategy.class;
}
}
static {
LIST.add(DESCRIPTOR);
Jobs.PROPERTIES.add(AuthorizationMatrixProperty.DESCRIPTOR);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册