18,7 → 18,8 |
UserBeforeDeleteListener, |
UserDeletingListener, |
InetDomainBeforeDeleteListener, |
InetDomainDeletingListener |
InetDomainDeletingListener, |
MailboxDeletingListener |
{ |
private MailAliasStore store; |
|
33,6 → 34,11 |
throws ModelException |
{ |
UserManager.getInstance().addBeforeDeleteListener(this); |
UserManager.getInstance().addDeletingListener(this); |
InetDomainManager.getInstance().addBeforeDeleteListener(this); |
InetDomainManager.getInstance().addDeletingListener(this); |
// FIXME register for mailbox before delete event? or silently delete destinations? |
MailboxManager.getInstance().addDeletingListener(this); |
} |
|
public MailAlias create(User editor) |
85,6 → 91,8 |
public void save(User editor, MailAlias mailAlias) |
throws ModelException |
{ |
// FIXME: how the onwer can save new destinations if he has no right to save the alias? |
|
// security check |
if(!mailAlias.editableBy(editor)) |
throw new ModelSecurityException(); |
309,6 → 317,28 |
return cascade; |
} |
|
public void mailboxDeleting(User editor, Mailbox mailbox) |
throws ModelException |
{ |
Collection mailAliases = store.listMailAliasesForMailbox(mailbox); |
|
for(Iterator i = mailAliases.iterator(); i.hasNext(); ) { |
MailAlias mailAlias = (MailAlias)i.next(); |
System.out.println("mailboxDeleting: " + mailAlias); |
|
// FIXME is it possible that editor has right to delete mailbox |
// but has no right to change alias? |
if(mailAlias.mayChangeDestinations(editor)) { |
for(Iterator j = mailAlias.getDestinations(editor).iterator(); j.hasNext(); ) { |
MailAliasDestination dest = (MailAliasDestination)j.next(); |
if(mailbox == dest.getMailbox()) j.remove(); |
} |
|
save(editor, mailAlias); |
} |
} |
} |
|
public static final Integer SORT_ADDRESS = new Integer(1); |
public static final Integer SORT_DOMAIN = new Integer(2); |
|