Fixed sieve scripts missing compilation
This commit is contained in:
parent
21b3544895
commit
2ac063ef23
3
TODO.md
3
TODO.md
|
@ -376,4 +376,5 @@ method(
|
||||||
arg, arg, arg)
|
arg, arg, arg)
|
||||||
|
|
||||||
|
|
||||||
# Restart postfix on user pwd change/disabling
|
# dovecot sieve only allolws one fucking active script. refactor mailbox shit to replace active script symlink by orchestra. Create a generic wrapper that includes al filters (rc, imp and orchestra)
|
||||||
|
http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples
|
||||||
|
|
|
@ -9,7 +9,8 @@ from .models import Domain
|
||||||
|
|
||||||
class BatchDomainCreationAdminForm(forms.ModelForm):
|
class BatchDomainCreationAdminForm(forms.ModelForm):
|
||||||
name = forms.CharField(label=_("Names"), widget=forms.Textarea(attrs={'rows': 5, 'cols': 50}),
|
name = forms.CharField(label=_("Names"), widget=forms.Textarea(attrs={'rows': 5, 'cols': 50}),
|
||||||
help_text=_("Domain per line. All domains will have the provided account and records."))
|
help_text=_("Fully qualified domain name per line. "
|
||||||
|
"All domains will have the provided account and records."))
|
||||||
|
|
||||||
def clean_name(self):
|
def clean_name(self):
|
||||||
self.extra_names = []
|
self.extra_names = []
|
||||||
|
|
|
@ -247,7 +247,8 @@ class Record(models.Model):
|
||||||
help_text=_("Record TTL, defaults to %s") % settings.DOMAINS_DEFAULT_TTL,
|
help_text=_("Record TTL, defaults to %s") % settings.DOMAINS_DEFAULT_TTL,
|
||||||
validators=[validators.validate_zone_interval])
|
validators=[validators.validate_zone_interval])
|
||||||
type = models.CharField(_("type"), max_length=32, choices=TYPE_CHOICES)
|
type = models.CharField(_("type"), max_length=32, choices=TYPE_CHOICES)
|
||||||
value = models.CharField(_("value"), max_length=256)
|
value = models.CharField(_("value"), max_length=256, help_text=_("MX, NS and CNAME records "
|
||||||
|
"sould end with a dot."))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s %s IN %s %s" % (self.domain, self.get_ttl(), self.type, self.value)
|
return "%s %s IN %s %s" % (self.domain, self.get_ttl(), self.type, self.value)
|
||||||
|
|
|
@ -124,7 +124,7 @@ class AddressAdmin(SelectAccountAdminMixin, ExtendedModelAdmin):
|
||||||
list_filter = (HasMailboxListFilter, HasForwardListFilter)
|
list_filter = (HasMailboxListFilter, HasForwardListFilter)
|
||||||
fields = ('account_link', 'email_link', 'mailboxes', 'forward')
|
fields = ('account_link', 'email_link', 'mailboxes', 'forward')
|
||||||
add_fields = ('account_link', ('name', 'domain'), 'mailboxes', 'forward')
|
add_fields = ('account_link', ('name', 'domain'), 'mailboxes', 'forward')
|
||||||
inlines = [AutoresponseInline]
|
# inlines = [AutoresponseInline]
|
||||||
search_fields = ('forward', 'mailboxes__name', 'account__username', 'computed_email')
|
search_fields = ('forward', 'mailboxes__name', 'account__username', 'computed_email')
|
||||||
readonly_fields = ('account_link', 'domain_link', 'email_link')
|
readonly_fields = ('account_link', 'domain_link', 'email_link')
|
||||||
actions = (SendAddressEmail(),)
|
actions = (SendAddressEmail(),)
|
||||||
|
|
|
@ -31,12 +31,14 @@ class SieveFilteringMixin(object):
|
||||||
""") % context
|
""") % context
|
||||||
)
|
)
|
||||||
context['filtering_path'] = settings.MAILBOXES_SIEVE_PATH % context
|
context['filtering_path'] = settings.MAILBOXES_SIEVE_PATH % context
|
||||||
|
context['filtering_cpath'] = re.sub(r'\.sieve$', '.svbin', context['filtering_path'])
|
||||||
if content:
|
if content:
|
||||||
context['filtering'] = ('# %(banner)s\n' + content) % context
|
context['filtering'] = ('# %(banner)s\n' + content) % context
|
||||||
self.append(textwrap.dedent("""\
|
self.append(textwrap.dedent("""\
|
||||||
mkdir -p $(dirname '%(filtering_path)s')
|
mkdir -p $(dirname '%(filtering_path)s')
|
||||||
echo '%(filtering)s' > %(filtering_path)s
|
echo '%(filtering)s' > %(filtering_path)s
|
||||||
chown %(user)s:%(group)s %(filtering_path)s
|
sievec %(filtering_path)s
|
||||||
|
chown %(user)s:%(group)s {%(filtering_path)s,%(filtering_cpath)s}
|
||||||
""") % context
|
""") % context
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -28,8 +28,11 @@ MAILBOXES_HOME = Setting('MAILBOXES_HOME',
|
||||||
|
|
||||||
|
|
||||||
MAILBOXES_SIEVE_PATH = Setting('MAILBOXES_SIEVE_PATH',
|
MAILBOXES_SIEVE_PATH = Setting('MAILBOXES_SIEVE_PATH',
|
||||||
os.path.join('%(home)s/Maildir/sieve/orchestra.sieve'),
|
os.path.join('%(home)s/sieve/orchestra.sieve'),
|
||||||
help_text="Available fromat names: <tt>%s</tt>" % ', '.join(_names),
|
help_text="If you are using Dovecot you can use "
|
||||||
|
"<a href='http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration#line-130'>"
|
||||||
|
"<tt>sieve_before</tt></a> in order to make sure orchestra sieve script is exectued."
|
||||||
|
"<br>Available fromat names: <tt>%s</tt>" % ', '.join(_names),
|
||||||
validators=[Setting.string_format_validator(_backend_names)],
|
validators=[Setting.string_format_validator(_backend_names)],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -83,14 +86,14 @@ MAILBOXES_MAILBOX_FILTERINGS = Setting('MAILBOXES_MAILBOX_FILTERINGS',
|
||||||
# value: (verbose_name, filter)
|
# value: (verbose_name, filter)
|
||||||
'DISABLE': (_("Disable"), ''),
|
'DISABLE': (_("Disable"), ''),
|
||||||
'REJECT': (mark_safe_lazy(_("Reject spam (Score≥9)")), textwrap.dedent("""\
|
'REJECT': (mark_safe_lazy(_("Reject spam (Score≥9)")), textwrap.dedent("""\
|
||||||
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
|
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
|
||||||
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "9" {
|
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "9" {
|
||||||
discard;
|
discard;
|
||||||
stop;
|
stop;
|
||||||
}""")),
|
}""")),
|
||||||
'REJECT5': (mark_safe_lazy(_("Reject spam (Score≥5)")), textwrap.dedent("""\
|
'REJECT5': (mark_safe_lazy(_("Reject spam (Score≥5)")), textwrap.dedent("""\
|
||||||
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
|
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
|
||||||
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "5" {
|
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "5" {
|
||||||
discard;
|
discard;
|
||||||
stop;
|
stop;
|
||||||
}""")),
|
}""")),
|
||||||
|
|
|
@ -95,7 +95,10 @@ class Processes(AppOption):
|
||||||
class PHPEnableFunctions(PHPAppOption):
|
class PHPEnableFunctions(PHPAppOption):
|
||||||
name = 'enable_functions'
|
name = 'enable_functions'
|
||||||
verbose_name = _("Enable functions")
|
verbose_name = _("Enable functions")
|
||||||
help_text = ','.join(settings.WEBAPPS_PHP_DISABLED_FUNCTIONS)
|
help_text = '<tt>%s</tt>' % '<br>'.join([
|
||||||
|
','.join(settings.WEBAPPS_PHP_DISABLED_FUNCTIONS[i:i+10])
|
||||||
|
for i in range(0, len(settings.WEBAPPS_PHP_DISABLED_FUNCTIONS), 10)
|
||||||
|
])
|
||||||
regex = r'^[\w\.,-]+$'
|
regex = r'^[\w\.,-]+$'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from django.db import models
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from orchestra.api.serializers import HyperlinkedModelSerializer
|
from orchestra.api.serializers import HyperlinkedModelSerializer
|
||||||
|
@ -18,14 +19,27 @@ class OptionSerializer(serializers.ModelSerializer):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
class DataField(serializers.Field):
|
||||||
|
def to_representation(self, data):
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
class WebAppSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
class WebAppSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
||||||
options = OptionSerializer(required=False)
|
options = OptionSerializer(required=False)
|
||||||
|
data = DataField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WebApp
|
model = WebApp
|
||||||
fields = ('url', 'id', 'name', 'type', 'options')
|
fields = ('url', 'id', 'name', 'type', 'options', 'data')
|
||||||
postonly_fields = ('name', 'type')
|
postonly_fields = ('name', 'type')
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(WebAppSerializer, self).__init__(*args, **kwargs)
|
||||||
|
if isinstance(self.instance, models.Model):
|
||||||
|
type_serializer = self.instance.type_instance.serializer
|
||||||
|
if type_serializer:
|
||||||
|
self.fields['data'] = type_serializer()
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
options_data = validated_data.pop('options')
|
options_data = validated_data.pop('options')
|
||||||
webapp = super(WebAppSerializer, self).create(validated_data)
|
webapp = super(WebAppSerializer, self).create(validated_data)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Website(models.Model):
|
||||||
# port = models.PositiveIntegerField(_("port"),
|
# port = models.PositiveIntegerField(_("port"),
|
||||||
# choices=settings.WEBSITES_PORT_CHOICES,
|
# choices=settings.WEBSITES_PORT_CHOICES,
|
||||||
# default=settings.WEBSITES_DEFAULT_PORT)
|
# default=settings.WEBSITES_DEFAULT_PORT)
|
||||||
domains = models.ManyToManyField(settings.WEBSITES_DOMAIN_MODEL,
|
domains = models.ManyToManyField(settings.WEBSITES_DOMAIN_MODEL, blank=True,
|
||||||
related_name='websites', verbose_name=_("domains"))
|
related_name='websites', verbose_name=_("domains"))
|
||||||
contents = models.ManyToManyField('webapps.WebApp', through='websites.Content')
|
contents = models.ManyToManyField('webapps.WebApp', through='websites.Content')
|
||||||
is_active = models.BooleanField(_("active"), default=True)
|
is_active = models.BooleanField(_("active"), default=True)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
django==1.8.1
|
django==1.8.2
|
||||||
django-celery-email==1.0.4
|
django-celery-email==1.0.4
|
||||||
django-fluent-dashboard==0.5
|
django-fluent-dashboard==0.5
|
||||||
https://github.com/glic3rinu/django-admin-tools/archive/master.zip
|
https://github.com/glic3rinu/django-admin-tools/archive/master.zip
|
||||||
|
|
Loading…
Reference in a new issue