mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
WIP: amavis quarantine frontend
This commit is contained in:
@@ -2,6 +2,7 @@ build
|
||||
dist
|
||||
frontend/node_modules
|
||||
modoboa.egg-info
|
||||
docker/mariadb
|
||||
|
||||
.tox
|
||||
|
||||
|
||||
@@ -43,3 +43,4 @@ test_project/media
|
||||
# Docker
|
||||
docker/collections
|
||||
docker/redis
|
||||
docker/mariadb
|
||||
|
||||
@@ -16,6 +16,17 @@ services:
|
||||
LDAP_ADMIN_PASSWORD: test
|
||||
profiles: [ldap]
|
||||
|
||||
mariadb:
|
||||
image: mariadb:10
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: Password1000
|
||||
MARIADB_DATABASE: amavis
|
||||
|
||||
volumes:
|
||||
- ./docker/mariadb:/var/lib/mysql
|
||||
profiles: [mariadb]
|
||||
|
||||
rq:
|
||||
build:
|
||||
context: .
|
||||
|
||||
@@ -9,25 +9,26 @@ FROM base AS build
|
||||
|
||||
RUN apk add --update openssl librrd python3-dev libffi-dev \
|
||||
gcc g++ musl-dev libxml2-dev libxslt-dev \
|
||||
libressl-dev jpeg-dev rrdtool-dev file make \
|
||||
openssl-dev jpeg-dev rrdtool-dev file make \
|
||||
gettext freetype-dev cairo-dev cargo git \
|
||||
openldap-dev \
|
||||
mariadb-dev openldap-dev \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
RUN python3 -m venv $VIRTUAL_ENV
|
||||
WORKDIR /tmp
|
||||
COPY . /tmp
|
||||
RUN python -m pip install -U pip pip-tools ruff
|
||||
RUN pip-compile --output-file=requirements.txt pyproject.toml
|
||||
RUN pip-compile --extra=mysql --output-file=mysql-requirements.txt pyproject.toml
|
||||
RUN pip-compile --extra=ldap --output-file=ldap-requirements.txt pyproject.toml
|
||||
RUN pip-compile --extra=dev --output-file=dev-requirements.txt pyproject.toml
|
||||
RUN pip-compile --extra=test --output-file=test-requirements.txt pyproject.toml
|
||||
RUN pip install -r requirements.txt -r ldap-requirements.txt -r test-requirements.txt -r dev-requirements.txt
|
||||
RUN pip install -r requirements.txt -r mysql-requirements.txt -r ldap-requirements.txt -r test-requirements.txt -r dev-requirements.txt
|
||||
|
||||
FROM base AS run
|
||||
COPY docker/doveadm /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/doveadm
|
||||
COPY --from=build $VIRTUAL_ENV $VIRTUAL_ENV
|
||||
RUN apk add --no-cache --update openssl librrd libxslt libjpeg libressl git rrdtool libmagic sudo sqlite libldap \
|
||||
RUN apk add --no-cache --update openssl librrd libxslt libjpeg libressl git rrdtool libmagic sudo sqlite libldap mariadb-connector-c \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
RUN mkdir /code
|
||||
WORKDIR /code
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import repository from './repository'
|
||||
|
||||
export default {
|
||||
getQuarantineContent(params) {
|
||||
return repository.get('/amavis/quarantine/', { params })
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<v-card class="mt-6">
|
||||
<v-data-table-server
|
||||
v-model="selected"
|
||||
:headers="headers"
|
||||
:items="messages"
|
||||
:search="search"
|
||||
:loading="loading"
|
||||
:items-length="totalMessages"
|
||||
:page="currentPage"
|
||||
:items-per-page="itemsPerPageR"
|
||||
item-value="pk"
|
||||
elevation="0"
|
||||
show-select
|
||||
:sort-by="sortByR"
|
||||
@update:options="updatedOptions"
|
||||
>
|
||||
<template #top>
|
||||
<v-text-field
|
||||
v-model="search"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
:placeholder="$gettext('Search in messages')"
|
||||
variant="outlined"
|
||||
single-line
|
||||
flat
|
||||
hide-details
|
||||
density="compact"
|
||||
class="flex-grow-0 w-33 mr-4"
|
||||
clearable
|
||||
@click:clear="fetchContent"
|
||||
@keyup.enter="submitSearch"
|
||||
></v-text-field>
|
||||
</template>
|
||||
</v-data-table-server>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import api from '@/api/amavis'
|
||||
|
||||
const messages = ref([])
|
||||
const search = ref('')
|
||||
const totalMessages = ref(0)
|
||||
|
||||
const fetchContent = () => {}
|
||||
|
||||
const submitSearch = () => {}
|
||||
</script>
|
||||
@@ -426,6 +426,23 @@ const routes = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'quarantine',
|
||||
component: () => import('@/layouts/user/UserLayout.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'QuarantineView',
|
||||
component: () => import('@/views/quarantine/QuarantineView.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<div class="text-h5 ml-4">
|
||||
{{ $gettext('Quarantine') }}
|
||||
</div>
|
||||
|
||||
<QuarantineList />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import QuarantineList from '@/components/quarantine/QuarantineList'
|
||||
</script>
|
||||
@@ -177,6 +177,16 @@ class AccountViewSet(core_v1_viewsets.AccountViewSet):
|
||||
"url": "/admin",
|
||||
}
|
||||
)
|
||||
if "modoboa.amavis" in settings.MODOBOA_APPS:
|
||||
apps.append(
|
||||
{
|
||||
"name": "amavis",
|
||||
"label": _("Quarantine"),
|
||||
"icon": "mdi-server-security",
|
||||
"description": _("Amavis quarantine"),
|
||||
"url": "/user/quarantine",
|
||||
}
|
||||
)
|
||||
if hasattr(request.user, "mailbox"):
|
||||
if "modoboa.contacts" in settings.MODOBOA_APPS:
|
||||
apps += [
|
||||
|
||||
@@ -192,3 +192,13 @@ class Command(BaseCommand):
|
||||
}}
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# ADD SIGNAL FOR THAT
|
||||
# def load_initial_data(self):
|
||||
# """Create records for existing domains and co."""
|
||||
# for dom in Domain.objects.all():
|
||||
# policy = create_user_and_policy("@{0}".format(dom.name))
|
||||
# for domalias in dom.domainalias_set.all():
|
||||
# domalias_pattern = "@{0}".format(domalias.name)
|
||||
# create_user_and_use_policy(domalias_pattern, policy)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""External API urls."""
|
||||
|
||||
from django.conf import settings
|
||||
from django.urls import include, path
|
||||
|
||||
from modoboa.core.extensions import exts_pool
|
||||
@@ -25,4 +26,9 @@ urlpatterns = [
|
||||
path("webmail/", include("modoboa.webmail.urls")),
|
||||
]
|
||||
|
||||
if "modoboa.amavis" in settings.MODOBOA_APPS:
|
||||
urlpatterns += [
|
||||
path("amavis/", include("modoboa.amavis.urls")),
|
||||
]
|
||||
|
||||
urlpatterns += exts_pool.get_urls(category="api")
|
||||
|
||||
@@ -104,6 +104,7 @@ MODOBOA_APPS = (
|
||||
"modoboa.contacts",
|
||||
"modoboa.calendars",
|
||||
"modoboa.webmail",
|
||||
"modoboa.amavis",
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -376,6 +377,7 @@ LOGGING = {
|
||||
|
||||
SILENCED_SYSTEM_CHECKS = [
|
||||
"security.W019", # modoboa uses iframes to display e-mails
|
||||
"fields.W342",
|
||||
]
|
||||
|
||||
DISABLE_DASHBOARD_EXTERNAL_QUERIES = False
|
||||
@@ -387,3 +389,16 @@ LDAP_SERVER_PORT = os.environ.get("LDAP_SERVER_PORT", 3389)
|
||||
WEBMAIL_DEV_MODE = os.environ.get("WEBMAIL_DEV_MODE", "off") == "on"
|
||||
WEBMAIL_DEV_USERNAME = os.environ.get("WEBMAIL_DEV_USERNAME", "")
|
||||
WEBMAIL_DEV_PASSWORD = os.environ.get("WEBMAIL_DEV_PASSWORD", "")
|
||||
|
||||
# Amavis
|
||||
|
||||
DATABASES["amavis"] = { # NOQA
|
||||
"ENGINE": "django.db.backends.mysql",
|
||||
"HOST": "mariadb",
|
||||
"NAME": "amavis",
|
||||
"USER": "root",
|
||||
"PASSWORD": "Password1000",
|
||||
}
|
||||
|
||||
DATABASE_ROUTERS = ["modoboa.amavis.dbrouter.AmavisRouter"]
|
||||
AMAVIS_DEFAULT_DATABASE_ENCODING = "LATIN1"
|
||||
|
||||
Reference in New Issue
Block a user