Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1045 → Rev 1046

/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserManager.java
22,6 → 22,7
{
private UserStore store;
private UserValidator userValidator;
private Class[] passwordStores;
 
private Collection createdListeners = new ArrayList();
private Collection modifiedListeners = new ArrayList();
45,14 → 46,10
 
User user = new User();
 
if(!user.mayChangeBoss(editor)) { // ordinal user can create only own "subusers"
if(!user.mayChangeBoss(editor)) // ordinal user can create only own "subusers"
user.setBoss(editor);
}
 
// FIXME: make this configurable
user.addPasswordStore(new PasswordStoreMd5());
user.addPasswordStore(new PasswordStoreCrypt());
user.addPasswordStore(new PasswordStorePlain());
setUserPasswordStores(user);
 
return user;
}
315,6 → 312,20
}
}
 
protected void setUserPasswordStores(User user)
throws ModelException
{
if(passwordStores == null) return;
 
try {
for(int i = 0; i < passwordStores.length; i++)
user.addPasswordStore((PasswordStore)passwordStores[i].newInstance());
}
catch(Exception ex) {
throw new ModelException(ex);
}
}
 
public static final Integer SORT_LOGIN = new Integer(1);
 
public static final Comparator LOGIN_COMPARATOR = new LoginComparator();
380,14 → 391,22
try {
userManager = this;
 
Class c = Class.forName((String)params.get("store"));
Class c = Class.forName(((String[])params.get("store"))[0]);
store = (UserStore)c.newInstance();
 
String userValidatorName = (String)params.get("userValidator");
String[] userValidatorName = (String[])params.get("userValidator");
if(userValidatorName != null) {
Class c2 = Class.forName(userValidatorName);
Class c2 = Class.forName(userValidatorName[0]);
userValidator = (UserValidator)c2.newInstance();
}
 
String[] passwordStoreNames = (String[])params.get("passwordStore");
if(passwordStoreNames != null) {
passwordStores = new Class[passwordStoreNames.length];
for(int i = 0; i < passwordStoreNames.length; i++) {
passwordStores[i] = Class.forName(passwordStoreNames[i]);
}
}
}
catch(Exception ex) {
throw new ModelException(ex);