Exemple #1
0
def create_relay_domains_records():
    """Create records for existing relay domains."""
    from modoboa.extensions.postfix_relay_domains.models import RelayDomain

    for rdom in RelayDomain.objects.all():
        policy = create_user_and_policy("@{0}".format(rdom.name))
        for rdomalias in rdom.relaydomainalias_set.all():
            rdomalias_pattern = "@{0}".format(rdomalias.name)
            create_user_and_use_policy(rdomalias_pattern, policy)
Exemple #2
0
def create_relay_domains_records():
    """Create records for existing relay domains."""
    from modoboa.extensions.postfix_relay_domains.models import RelayDomain

    for rdom in RelayDomain.objects.all():
        policy = create_user_and_policy("@{0}".format(rdom.name))
        for rdomalias in rdom.relaydomainalias_set.all():
            rdomalias_pattern = "@{0}".format(rdomalias.name)
            create_user_and_use_policy(rdomalias_pattern, policy)
Exemple #3
0
def init_amavis_dependant_features():
    """Populate amavis database.

    We create records for *users* and *policy* tables for each defined
    relay domain or relay domain alias.
    """
    from modoboa.extensions.amavis.models import Users
    from modoboa.extensions.amavis.lib import (create_user_and_policy,
                                               create_user_and_use_policy)

    for rdom in RelayDomain.objects.all():
        try:
            Users.objects.get(email="@%s" % rdom.name)
        except Users.DoesNotExist:
            create_user_and_policy(rdom.name)
        for rdomalias in rdom.relaydomainalias_set.all():
            try:
                Users.objects.get(email='@%s' % rdomalias.name)
            except Users.DoesNotExist:
                create_user_and_use_policy(rdomalias.name, rdom.name)
Exemple #4
0
    def init(self):
        """Init function

        Only run once, when the extension is enabled. We create records
        for existing domains to let Amavis consider them local.
        """
        from modoboa.extensions.admin.models import Domain
        from modoboa.extensions.amavis.models import Users
        from modoboa.extensions.amavis.lib import (create_user_and_policy,
                                                   create_user_and_use_policy)

        for dom in Domain.objects.all():
            try:
                Users.objects.get(email="@%s" % dom.name)
            except Users.DoesNotExist:
                create_user_and_policy(dom.name)
            for domalias in dom.domainalias_set.all():
                try:
                    Users.objects.get(email='@%s' % domalias.name)
                except Users.DoesNotExist:
                    create_user_and_use_policy(domalias.name, dom.name)
Exemple #5
0
def init_amavis_dependant_features():
    """Populate amavis database.

    We create records for *users* and *policy* tables for each defined
    relay domain or relay domain alias.
    """
    from modoboa.extensions.amavis.models import Users
    from modoboa.extensions.amavis.lib import (
        create_user_and_policy, create_user_and_use_policy
    )

    for rdom in RelayDomain.objects.all():
        try:
            Users.objects.get(email="@%s" % rdom.name)
        except Users.DoesNotExist:
            create_user_and_policy(rdom.name)
        for rdomalias in rdom.relaydomainalias_set.all():
            try:
                Users.objects.get(email='@%s' % rdomalias.name)
            except Users.DoesNotExist:
                create_user_and_use_policy(rdomalias.name, rdom.name)
Exemple #6
0
    def init(self):
        """Init function

        Only run once, when the extension is enabled. We create records
        for existing domains to let Amavis consider them local.
        """
        from modoboa.extensions.admin.models import Domain
        from modoboa.extensions.amavis.models import Users
        from modoboa.extensions.amavis.lib import (
            create_user_and_policy, create_user_and_use_policy
        )

        for dom in Domain.objects.all():
            try:
                Users.objects.get(email="@%s" % dom.name)
            except Users.DoesNotExist:
                create_user_and_policy(dom.name)
            for domalias in dom.domainalias_set.all():
                try:
                    Users.objects.get(email='@%s' % domalias.name)
                except Users.DoesNotExist:
                    create_user_and_use_policy(domalias.name, dom.name)
def on_domain_created(user, domain):
    create_user_and_policy("@{0}".format(domain.name))
Exemple #8
0
def on_domain_created(user, domain):
    create_user_and_policy("@{0}".format(domain.name))
Exemple #9
0
def on_relay_domain_created(user, rdomain):
    create_user_and_policy(rdomain.name)
Exemple #10
0
def on_domain_created(user, domain):
    create_user_and_policy(domain.name)
Exemple #11
0
def on_domain_created(user, domain):
    create_user_and_policy(domain.name)
Exemple #12
0
def on_relay_domain_created(user, rdomain):
    create_user_and_policy("@{0}".format(rdomain.name))
Exemple #13
0
def on_relay_domain_created(user, rdomain):
    create_user_and_policy(rdomain.name)