Mail backend fixes

This commit is contained in:
Marc 2014-09-29 12:22:45 +00:00
parent e3ce126fd4
commit 6a52e99d10
7 changed files with 31 additions and 6 deletions

14
TODO.md
View file

@ -16,7 +16,7 @@ TODO
* move invoice contact to invoices app?
* PHPbBckendMiixin with get_php_ini
* Apache: `IncludeOptional /etc/apache2/extra-vhos[t]/account-site-custom.con[f]`
* rename account.user to primary_user
* rename account.user to main_user
* webmail identities and addresses
* cached -> cached_property
* user.roles.mailbox its awful when combined with addresses:
@ -115,3 +115,15 @@ Remember that, as always with QuerySets, any subsequent chained methods which im
- system users are independent users, so they can have different passwords and all.
* take a look icons from ajenti ;)
* Disable services is_active should be computed on the fly in order to distinguish account.is_active from service.is_active when reactivation.
* Perhaps it is time to create a ServiceModel ?
* COpy account.main_user.username to account.name for performance
* service backend execution dependency? first create user on NIS master then create directories on service server
* prevent deletion of main user by the user itself

View file

@ -29,7 +29,7 @@ class MailboxAdmin(AccountAdminMixin, ExtendedModelAdmin):
list_filter = ('use_custom_filtering', HasAddressListFilter)
add_fieldsets = (
(None, {
'fields': ('account', 'name'),
'fields': ('account', 'name', 'password'),
}),
(_("Filtering"), {
'fields': ('use_custom_filtering', 'custom_filtering'),

View file

@ -55,10 +55,10 @@ class MailSystemUserBackend(ServiceController):
self.append("rm -fr %(home)s" % context)
def get_context(self, mailbox):
user = mailbox.user
context = {
'username': user.username,
'password': user.password if user.is_active else '*%s' % user.password,
'name': mailbox.nam,
'username': mailbox.name,
'password': mailbox.password if mailbox.is_active else '*%s' % mailbox.password,
'group': self.DEFAULT_GROUP
}
context['home'] = settings.EMAILS_HOME % context

View file

@ -13,6 +13,7 @@ class Mailbox(models.Model):
"@/./+/-/_ only."),
validators=[RegexValidator(r'^[\w.@+-]+$',
_("Enter a valid mailbox name."), 'invalid')])
password = models.CharField(_("password"), max_length=128)
account = models.ForeignKey('accounts.Account', verbose_name=_("account"),
related_name='mailboxes')
use_custom_filtering = models.BooleanField(_("Use custom filtering"),
@ -20,6 +21,7 @@ class Mailbox(models.Model):
custom_filtering = models.TextField(_("filtering"), blank=True,
validators=[validators.validate_sieve],
help_text=_("Arbitrary email filtering in sieve language."))
is_active = models.BooleanField(_("is active"), default=True)
# addresses = models.ManyToManyField('mails.Address',
# verbose_name=_("addresses"),
# related_name='mailboxes', blank=True)

View file

@ -3,7 +3,7 @@ from django.conf import settings
EMAILS_DOMAIN_MODEL = getattr(settings, 'EMAILS_DOMAIN_MODEL', 'domains.Domain')
EMAILS_HOME = getattr(settings, 'EMAILS_HOME', '/var/vmail/%(account)s/%(name)s/')
EMAILS_HOME = getattr(settings, 'EMAILS_HOME', '/home/%(username)s/')
EMAILS_SIEVETEST_PATH = getattr(settings, 'EMAILS_SIEVETEST_PATH', '/dev/shm')

View file

@ -17,5 +17,6 @@ class POSIX(models.Model):
def __unicode__(self):
return str(self.user)
# TODO groups
roles.register('posix', POSIX)

View file

@ -21,3 +21,13 @@ wget -O - http://apt.baruwa.org/baruwa-apt-keys.gpg | apt-key add -
apt-get update
apt-get install mailscanner
apt-get install dovecot-core dovecot-imapd dovecot-pop3d dovecot-sieve
apt-get install postfix
mail_location = maildir:~/Maildir