mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
fixed #165.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1149 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
2c6a3afdd6
commit
462e533a3d
1 file changed
+12
-7
@@ -3,6 +3,7 @@ package hudson.model;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import hudson.FeedAdapter;
|
||||
import hudson.XmlFile;
|
||||
import hudson.CopyOnWrite;
|
||||
import hudson.model.Descriptor.FormException;
|
||||
import hudson.scm.ChangeLogSet;
|
||||
import hudson.util.RunList;
|
||||
@@ -37,8 +38,8 @@ public class User extends AbstractModelObject {
|
||||
|
||||
/**
|
||||
* List of {@link UserProperty}s configured for this project.
|
||||
* Copy-on-write semantics.
|
||||
*/
|
||||
@CopyOnWrite
|
||||
private volatile List<UserProperty> properties = new ArrayList<UserProperty>();
|
||||
|
||||
|
||||
@@ -46,12 +47,6 @@ public class User extends AbstractModelObject {
|
||||
this.id = id;
|
||||
this.fullName = id; // fullName defaults to name
|
||||
|
||||
for (UserPropertyDescriptor d : UserProperties.LIST) {
|
||||
UserProperty up = d.newInstance(this);
|
||||
if(up!=null)
|
||||
properties.add(up);
|
||||
}
|
||||
|
||||
// load the other data from disk if it's available
|
||||
XmlFile config = getConfigFile();
|
||||
try {
|
||||
@@ -61,6 +56,16 @@ public class User extends AbstractModelObject {
|
||||
LOGGER.log(Level.SEVERE, "Failed to load "+config,e);
|
||||
}
|
||||
|
||||
// allocate default instances if needed.
|
||||
// doing so after load makes sure that newly added user properties do get reflected
|
||||
for (UserPropertyDescriptor d : UserProperties.LIST) {
|
||||
if(getProperty(d.clazz)==null) {
|
||||
UserProperty up = d.newInstance(this);
|
||||
if(up!=null)
|
||||
properties.add(up);
|
||||
}
|
||||
}
|
||||
|
||||
for (UserProperty p : properties)
|
||||
p.setUser(this);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user