diff --git a/doc/configuration.rst b/doc/configuration.rst index 808f3193b..ee4368555 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -644,31 +644,3 @@ Hash the file using the following command:: Finally, reload postfix:: $ service postfix reload - -************************ -Auto-reply using Postfix -************************ - -The user that executes the autoreply script needs to access -:file:`settings.py`. You must apply proper permissions on this file. For -example, if :file:`settings.py` belongs to ``www-data:www-data``, you can add -the ``vmail`` user to the ``www-data`` group and set the read permission -for the group. - -To make Postfix use this feature, you need to update your -configuration file as follows: - -``/etc/postfix/master.cf``:: - - autoreply unix - n n - - pipe - flags= user=vmail: argv=python /manage.py autoreply $sender $mailbox - -Replace ```` by the name of the database you -use. ```` is the path of your Modoboa instance. - -.. note:: - - Auto-reply messages are just sent once per sender for a - pre-defined time period. By default, this period is equal to 1 day - (86400s), you can adjust this value by modifying the **Automatic - reply timeout** parameter available in the online panel. diff --git a/modoboa/autoreply/api/v2/viewsets.py b/modoboa/autoreply/api/v2/viewsets.py index f9d5aab10..703445c56 100644 --- a/modoboa/autoreply/api/v2/viewsets.py +++ b/modoboa/autoreply/api/v2/viewsets.py @@ -7,6 +7,7 @@ from rest_framework.decorators import action from modoboa.admin import models as admin_models from modoboa.lib.email_utils import split_mailbox +from modoboa.lib.viewsets import HasMailbox from modoboa.parameters import tools as param_tools from modoboa.autoreply import models @@ -61,7 +62,10 @@ class ARMessageViewSet( class AccountARMessageViewSet(viewsets.ViewSet): """A viewset dedicated to connected account.""" - permission_classes = (permissions.IsAuthenticated,) + permission_classes = ( + permissions.IsAuthenticated, + HasMailbox, + ) serializer_class = serializers.AccountARMessageSerializer @extend_schema( diff --git a/modoboa/sievefilters/api/v2/viewsets.py b/modoboa/sievefilters/api/v2/viewsets.py index 7f56b93cc..b025e0aa5 100644 --- a/modoboa/sievefilters/api/v2/viewsets.py +++ b/modoboa/sievefilters/api/v2/viewsets.py @@ -10,7 +10,7 @@ from django.utils.translation import gettext as _ from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import extend_schema, OpenApiParameter -from rest_framework import response, viewsets +from rest_framework import permissions, response, viewsets from rest_framework.decorators import action from modoboa.lib.viewsets import HasMailbox @@ -33,7 +33,10 @@ FILTER_SET_ID = OpenApiParameter( class FilterSetViewSet(viewsets.ViewSet): - permission_classes = (HasMailbox,) + permission_classes = ( + permissions.IsAuthenticated, + HasMailbox, + ) serializer_class = serializers.FilterSetSerializer def get_sieve_client(self, request):