mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
+2
-28
@@ -120,35 +120,9 @@ class AccountViewSet(viewsets.ModelViewSet):
|
||||
|
||||
|
||||
class AliasViewSet(viewsets.ModelViewSet):
|
||||
"""ViewSet for Alias.
|
||||
|
||||
---
|
||||
"""
|
||||
create:
|
||||
serializer: modoboa.admin.serializers.AliasSerializer
|
||||
parameters:
|
||||
- name: recipients
|
||||
description: recipient(s) of the alias
|
||||
required: true
|
||||
type: array[string]
|
||||
paramType: form
|
||||
|
||||
update:
|
||||
serializer: modoboa.admin.serializers.AliasSerializer
|
||||
parameters:
|
||||
- name: recipients
|
||||
description: recipient(s) of the alias
|
||||
required: true
|
||||
type: array[string]
|
||||
paramType: form
|
||||
|
||||
partial_update:
|
||||
serializer: modoboa.admin.serializers.AliasSerializer
|
||||
parameters:
|
||||
- name: recipients
|
||||
description: recipient(s) of the alias
|
||||
required: true
|
||||
type: array[string]
|
||||
paramType: form
|
||||
Create a new alias instance.
|
||||
"""
|
||||
|
||||
permission_classes = [IsAuthenticated, DjangoModelPermissions, ]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
|
||||
from rest_framework import serializers
|
||||
from passwords import validators
|
||||
@@ -317,7 +317,8 @@ class AliasSerializer(serializers.ModelSerializer):
|
||||
address = lib_fields.DRFEmailFieldUTF8AndEmptyUser()
|
||||
recipients = serializers.ListField(
|
||||
child=lib_fields.DRFEmailFieldUTF8AndEmptyUser(),
|
||||
allow_empty=False)
|
||||
allow_empty=False,
|
||||
help_text=ugettext_lazy("A list of recipient"))
|
||||
|
||||
class Meta:
|
||||
model = admin_models.Alias
|
||||
|
||||
@@ -50,8 +50,8 @@ INSTALLED_APPS = (
|
||||
'reversion',
|
||||
'ckeditor',
|
||||
'ckeditor_uploader',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'rest_framework_swagger',
|
||||
{% if devmode %} 'djangobower',{% endif %}
|
||||
)
|
||||
|
||||
@@ -167,6 +167,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
),
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
'rest_framework.permissions.IsAuthenticated',
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
<h2>{% trans "API access" %} <small>{% trans "Control your access to Modoboa API" %}</small></h2>
|
||||
<hr>
|
||||
<div class="alert alert-info">
|
||||
{% url "api-docs:docs-index" as api_doc_url %}
|
||||
{% blocktrans with url=api_doc_url trimmed %}
|
||||
A documentation of the API is available <strong><a href="{{ url }}" target="_blank">here</a></strong>.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% if user.auth_token %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
|
||||
+4
-1
@@ -5,11 +5,14 @@ from django.views.i18n import JavaScriptCatalog
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from ckeditor_uploader import views as cku_views
|
||||
from rest_framework.documentation import include_docs_urls
|
||||
|
||||
from modoboa.admin.views.user import forward
|
||||
from modoboa.core.extensions import exts_pool
|
||||
from modoboa.core import signals as core_signals
|
||||
|
||||
API_TITLE = 'Modoboa API'
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
|
||||
url(r'^ckeditor/upload/', login_required(cku_views.upload),
|
||||
@@ -34,7 +37,7 @@ if extra_routes:
|
||||
# API urls
|
||||
urlpatterns += [
|
||||
url("^api/v1/", include("modoboa.urls_api", namespace="external_api")),
|
||||
url("^docs/api/", include('rest_framework_swagger.urls')),
|
||||
url(r"^docs/api/", include_docs_urls(title=API_TITLE))
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
+1
-2
@@ -8,8 +8,7 @@ django-xforwardedfor-middleware
|
||||
|
||||
dj-database-url
|
||||
|
||||
djangorestframework==3.5.3
|
||||
django-rest-swagger==0.3.10
|
||||
djangorestframework==3.6.2
|
||||
|
||||
argparse
|
||||
# bcrypt requires libffi-dev
|
||||
|
||||
Reference in New Issue
Block a user