/hostadmiral/trunk/src/ak/hostadmiral/listener/uservalidatoratdomain/UserValidatorAtDomain.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/listener/uservalidatoratdomain/UserValidatorAtDomainMessages.properties |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainValidateListener.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserValidateListener.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasValidateListener.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxValidateListener.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserValidateListener.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasManager.java |
---|
22,7 → 22,6 |
{ |
private MailAliasStore store; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
85,21 → 84,12 |
public void save(User editor, MailAlias mailAlias) |
throws ModelException |
{ |
// security check |
if(!mailAlias.editableBy(editor)) |
throw new ModelSecurityException(); |
//mailAlias.setModUser(editor); // FIXME |
boolean isNew = mailAlias.isNew(); |
MailAlias oldMailAlias = mailAlias.getOrigin(); |
if(oldMailAlias == null) oldMailAlias = mailAlias; |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
MailAliasValidateListener listener = (MailAliasValidateListener)i.next(); |
listener.mailAliasValidate(editor, mailAlias, oldMailAlias); |
} |
//mailAlias.setModUser(editor); // FIXME |
store.save(mailAlias); |
111,6 → 101,8 |
} |
} |
else { |
MailAlias oldMailAlias = mailAlias.getOrigin(); |
if(oldMailAlias == null) oldMailAlias = mailAlias; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
MailAliasModifiedListener listener = (MailAliasModifiedListener)i.next(); |
listener.mailAliasModified(editor, mailAlias, oldMailAlias); |
121,16 → 113,6 |
mailAlias.resetOrigin(); |
} |
public void addValidateListener(MailAliasValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(MailAliasValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(MailAliasCreatedListener listener) |
{ |
createdListeners.add(listener); |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserManager.java |
---|
21,9 → 21,9 |
UserDeletingListener |
{ |
private UserStore store; |
private UserValidator userValidator; |
private Class[] passwordStores; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
92,7 → 92,6 |
public void save(User editor, User user) |
throws ModelException |
{ |
// security check |
if(!user.editableBy(editor) && !user.partEditableBy(editor) |
&& !user.mayChangeSuperuser(editor)) |
{ |
99,18 → 98,13 |
throw new ModelSecurityException(); |
} |
//user.setModUser(editor); // FIXME: disabled because hb throws exception |
// if user edits itself |
if(userValidator != null) |
userValidator.validateUser(editor, user); |
boolean isNew = user.isNew(); |
User oldUser = user.getOrigin(); |
if(oldUser == null) oldUser = user; |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
UserValidateListener listener = (UserValidateListener)i.next(); |
listener.userValidate(editor, user, oldUser); |
} |
//user.setModUser(editor); // FIXME: disabled because hb throws exception |
// if user edits itself |
store.save(user); |
129,6 → 123,8 |
} |
} |
else { |
User oldUser = user.getOrigin(); |
if(oldUser == null) oldUser = user; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
UserModifiedListener listener = (UserModifiedListener)i.next(); |
listener.userModified(editor, user, oldUser); |
139,16 → 135,6 |
user.resetOrigin(); |
} |
public void addValidateListener(UserValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(UserValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(UserCreatedListener listener) |
{ |
createdListeners.add(listener); |
421,6 → 407,12 |
Class c = Class.forName(((String[])params.get("store"))[0]); |
store = (UserStore)c.newInstance(); |
String[] userValidatorName = (String[])params.get("userValidator"); |
if(userValidatorName != null) { |
Class c2 = Class.forName(userValidatorName[0]); |
userValidator = (UserValidator)c2.newInstance(); |
} |
String[] passwordStoreNames = (String[])params.get("passwordStore"); |
if(passwordStoreNames != null) { |
passwordStores = new Class[passwordStoreNames.length]; |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainManager.java |
---|
20,7 → 20,6 |
{ |
private InetDomainStore store; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
79,21 → 78,12 |
public void save(User editor, InetDomain domain) |
throws ModelException |
{ |
// security check |
if(!domain.editableBy(editor)) |
throw new ModelSecurityException(); |
//domain.setModUser(editor); // FIXME |
boolean isNew = domain.isNew(); |
InetDomain oldDomain = domain.getOrigin(); |
if(oldDomain == null) oldDomain = domain; |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
InetDomainValidateListener listener = (InetDomainValidateListener)i.next(); |
listener.inetDomainValidate(editor, domain, oldDomain); |
} |
//domain.setModUser(editor); // FIXME |
store.save(domain); |
105,6 → 95,8 |
} |
} |
else { |
InetDomain oldDomain = domain.getOrigin(); |
if(oldDomain == null) oldDomain = domain; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
InetDomainModifiedListener listener = (InetDomainModifiedListener)i.next(); |
listener.inetDomainModified(editor, domain, oldDomain); |
115,16 → 107,6 |
domain.resetOrigin(); |
} |
public void addValidateListener(InetDomainValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(InetDomainValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(InetDomainCreatedListener listener) |
{ |
createdListeners.add(listener); |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxManager.java |
---|
25,7 → 25,6 |
private MailboxStore store; |
private Class[] passwordStores; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
91,21 → 90,12 |
public void save(User editor, Mailbox mailbox) |
throws ModelException |
{ |
// security check |
if(!mailbox.editableBy(editor)) |
throw new ModelSecurityException(); |
//mailbox.setModUser(editor); // FIXME |
boolean isNew = mailbox.isNew(); |
Mailbox oldMailbox = mailbox.getOrigin(); |
if(oldMailbox == null) oldMailbox = mailbox; |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
MailboxValidateListener listener = (MailboxValidateListener)i.next(); |
listener.mailboxValidate(editor, mailbox, oldMailbox); |
} |
//mailbox.setModUser(editor); // FIXME |
store.save(mailbox); |
117,6 → 107,8 |
} |
} |
else { |
Mailbox oldMailbox = mailbox.getOrigin(); |
if(oldMailbox == null) oldMailbox = mailbox; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
MailboxModifiedListener listener = (MailboxModifiedListener)i.next(); |
listener.mailboxModified(editor, mailbox, oldMailbox); |
127,16 → 119,6 |
mailbox.resetOrigin(); |
} |
public void addValidateListener(MailboxValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(MailboxValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(MailboxCreatedListener listener) |
{ |
createdListeners.add(listener); |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserManager.java |
---|
20,7 → 20,6 |
{ |
private SystemUserStore store; |
private Collection validateListeners = new ArrayList(); |
private Collection createdListeners = new ArrayList(); |
private Collection modifiedListeners = new ArrayList(); |
private Collection beforeDeleteListeners = new ArrayList(); |
95,21 → 94,12 |
public void save(User editor, SystemUser systemUser) |
throws ModelException |
{ |
// security check |
if(!systemUser.editableBy(editor)) |
throw new ModelSecurityException(); |
//systemUser.setModUser(editor); // FIXME |
boolean isNew = systemUser.isNew(); |
SystemUser oldSystemUser = systemUser.getOrigin(); |
if(oldSystemUser == null) oldSystemUser = systemUser; |
// validate |
for(Iterator i = validateListeners.iterator(); i.hasNext(); ) { |
SystemUserValidateListener listener = (SystemUserValidateListener)i.next(); |
listener.systemUserValidate(editor, systemUser, oldSystemUser); |
} |
//systemUser.setModUser(editor); // FIXME |
store.save(systemUser); |
121,6 → 111,8 |
} |
} |
else { |
SystemUser oldSystemUser = systemUser.getOrigin(); |
if(oldSystemUser == null) oldSystemUser = systemUser; |
for(Iterator i = modifiedListeners.iterator(); i.hasNext(); ) { |
SystemUserModifiedListener listener = (SystemUserModifiedListener)i.next(); |
listener.systemUserModified(editor, systemUser, oldSystemUser); |
131,16 → 123,6 |
systemUser.resetOrigin(); |
} |
public void addValidateListener(SystemUserValidateListener listener) |
{ |
validateListeners.add(listener); |
} |
public void removeValidateListener(SystemUserValidateListener listener) |
{ |
validateListeners.remove(listener); |
} |
public void addCreatedListener(SystemUserCreatedListener listener) |
{ |
createdListeners.add(listener); |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserValidatorAtDomain.java |
---|
0,0 → 1,36 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import java.util.Iterator; |
import ak.hostadmiral.util.ModelException; |
import ak.hostadmiral.util.ModelUserException; |
public class UserValidatorAtDomain |
implements UserValidator |
{ |
public void validateUser(User editor, User user) |
throws ModelException |
{ |
// superuser |
if(editor.isSuperuser()) return; |
// name not changed |
if(user.getOrigin() != null && user.getOrigin().getLogin() != null |
&& user.getLogin().equals(user.getOrigin().getLogin())) |
{ |
return; |
} |
// go throug all domains |
Collection domains = InetDomainManager.getInstance().listInetDomains(editor); |
for(Iterator i = domains.iterator(); i.hasNext(); ) { |
InetDomain domain = (InetDomain)i.next(); |
if(user.getLogin().endsWith("@" + domain.getName())) |
return; |
} |
// nothing found |
throw new ModelUserException("ak.hostadmiral.core.uservalidator.atdomain.login.wrong"); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserValidator.java |
---|
0,0 → 1,9 |
package ak.hostadmiral.core.model; |
import ak.hostadmiral.util.ModelException; |
public interface UserValidator |
{ |
public void validateUser(User editor, User user) |
throws ModelException; |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserDeletingListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserDeletingListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxDeletingListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxDeletingListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasDeletingListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasDeletingListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainDeletingListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainDeletingListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserDeletingListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserDeletingListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainModifiedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainModifiedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserDeletedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserDeletedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserCreatedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserCreatedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxDeletedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxDeletedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxCreatedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxCreatedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/SystemUserModifiedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface SystemUserModifiedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailboxModifiedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailboxModifiedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasModifiedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasModifiedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainDeletedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainDeletedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/InetDomainCreatedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface InetDomainCreatedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasDeletedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasDeletedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/MailAliasCreatedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface MailAliasCreatedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserDeletedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserDeletedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserCreatedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserCreatedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/model/UserModifiedListener.java |
---|
1,5 → 1,6 |
package ak.hostadmiral.core.model; |
import java.util.Collection; |
import ak.hostadmiral.util.ModelException; |
public interface UserModifiedListener |
/hostadmiral/trunk/src/ak/hostadmiral/core/resources/CoreMessages.properties |
---|
56,3 → 56,5 |
ak.hostadmiral.core.domain.edit.name.empty=Please enter domain name |
ak.hostadmiral.core.mail.alias.edit.id.wrong=Please select an alias from the list |
ak.hostadmiral.core.uservalidator.atdomain.login.wrong=User login must end with name of your domain, e.g. me@example.com |
/hostadmiral/trunk/src/ak/hostadmiral/core/Locales.java |
---|
2,7 → 2,6 |
import java.util.Locale; |
// FIXME: make this list as text file or build it directly from resources |
public abstract class Locales |
{ |
private static final Locale[] locales = { |
/hostadmiral/trunk/src/ak/hostadmiral/struts/MultiPropertyMessageResources.java |
---|
1,14 → 1,8 |
package ak.hostadmiral.struts; |
import java.util.HashMap; |
import java.util.List; |
import java.util.ArrayList; |
import java.util.Iterator; |
import org.apache.struts.util.PropertyMessageResources; |
import ak.hostadmiral.util.ResourceManager; |
import ak.hostadmiral.util.ResourceAddedListener; |
/** |
* Extention of PropertyMessageResources to work with multiple |
* resource files, specified as semicolomn separated list. |
16,10 → 10,9 |
*/ |
public class MultiPropertyMessageResources |
extends PropertyMessageResources |
implements ResourceAddedListener |
{ |
private List multiLocales = new ArrayList(); // List(HashMap) |
private List multiConfig = new ArrayList(); // List(String) |
private HashMap[] multiLocales; |
private String[] multiConfig; |
public MultiPropertyMessageResources(MultiPropertyMessageResourcesFactory factory, |
String config) |
26,7 → 19,6 |
{ |
super(factory, config); |
initMultiConfig(config); |
ResourceManager.getInstance().addAddedListener(this); |
} |
public MultiPropertyMessageResources(MultiPropertyMessageResourcesFactory factory, |
34,14 → 26,13 |
{ |
super(factory, config, returnNull); |
initMultiConfig(config); |
ResourceManager.getInstance().addAddedListener(this); |
} |
protected synchronized void loadLocale(String localeKey) |
{ |
for(int i = 0; i < multiConfig.size(); i++) { |
config = (String)multiConfig.get(i); |
locales = (HashMap)multiLocales.get(i); |
for(int i = 0; i < multiConfig.length; i++) { |
config = multiConfig[i]; |
locales = multiLocales[i]; |
super.loadLocale(localeKey); |
} |
} |
48,24 → 39,10 |
protected void initMultiConfig(String cfg) |
{ |
// from struts-config.xml |
String[] strs = cfg.split("\\s*;\\s*"); |
this.multiConfig = cfg.split("\\s*;\\s*"); |
for(int i = 0; i < strs.length; i++) { |
this.multiConfig.add(strs[i]); |
this.multiLocales.add(new HashMap()); |
this.multiLocales = new HashMap[this.multiConfig.length]; |
for(int i = 0; i < this.multiLocales.length; i++) |
this.multiLocales[i] = new HashMap(); |
} |
// from resource manager |
for(Iterator i = ResourceManager.getInstance().getResources().iterator(); i.hasNext(); ) { |
this.multiConfig.add((String)i.next()); |
this.multiLocales.add(new HashMap()); |
} |
} |
public void resourceAdded(String resourceName) |
{ |
this.multiConfig.add(resourceName); |
this.multiLocales.add(new HashMap()); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/util/ResourceAddedListener.java |
---|
File deleted |
/hostadmiral/trunk/src/ak/hostadmiral/util/ResourceManager.java |
---|
File deleted |