call create/delete mailbox tasks when saving/deleting mailboxes

This commit is contained in:
Jan Dittberner 2014-12-27 16:31:43 +01:00
parent 505b9c934b
commit 54b99281e3
3 changed files with 20 additions and 0 deletions

View File

@ -1,6 +1,7 @@
Changelog
=========
* :feature:`-` call create/delete mailbox tasks when saving/deleting mailboxes
* :support:`-` use celery routers from gvacommon
* :feature:`-` automatic creation of mailbox names from user names
* :bug:`-` fix broken mailbox admin

View File

@ -7,6 +7,7 @@ from model_utils.models import TimeStampedModel
from domains.models import MailDomain
from osusers.models import User as OsUser
from osusers.tasks import create_file_mailbox, delete_file_mailbox
class ActivateAbleMixin(models.Model):
@ -53,6 +54,14 @@ class Mailbox(ActivateAbleMixin, TimeStampedModel, models.Model):
def set_password(self, password):
self.password = sha512_crypt.encrypt(password)
def save(self, *args, **kwargs):
create_file_mailbox.delay(self.osuser.username, self.username).get()
super(Mailbox, self).save(*args, **kwargs)
def delete(self, *args, **kwargs):
delete_file_mailbox.delay(self.osuser.username, self.username).get()
super(Mailbox, self).delete(*args, **kwargs)
def __str__(self):
return self.username

View File

@ -51,3 +51,13 @@ def setup_file_mail_userdir(username):
@shared_task
def delete_file_mail_userdir(username):
pass
@shared_task
def create_file_mailbox(username, mailboxname):
pass
@shared_task
def delete_file_mailbox(username, mailboxname):
pass