mirror of https://gitlab.federez.net/re2o/re2o
15 changed files with 820 additions and 165 deletions
@ -0,0 +1,30 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.10.7 on 2018-06-26 19:31 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('preferences', '0045_remove_unused_payment_fields'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='optionaluser', |
|||
name='local_email_accounts_enabled', |
|||
field=models.BooleanField(default=False, help_text='Enable local email accounts for users'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='optionaluser', |
|||
name='local_email_domain', |
|||
field=models.CharField(default='@example.org', help_text='Domain to use for local email accounts', max_length=32), |
|||
), |
|||
migrations.AddField( |
|||
model_name='optionaluser', |
|||
name='max_email_address', |
|||
field=models.IntegerField(default=15, help_text='Maximum number of local email address for a standard user'), |
|||
), |
|||
] |
|||
@ -0,0 +1,57 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.10.7 on 2018-06-29 14:14 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.conf import settings |
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
import re2o.mixins |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
def create_initial_email_address(apps, schema_editor): |
|||
db_alias = schema_editor.connection.alias |
|||
User = apps.get_model("users", "User") |
|||
EMailAddress = apps.get_model("users", "EMailAddress") |
|||
users = User.objects.using(db_alias).all() |
|||
for user in users: |
|||
EMailAddress.objects.using(db_alias).create( |
|||
local_part=user.pseudo, |
|||
user=user |
|||
) |
|||
|
|||
def delete_all_email_address(apps, schema_editor): |
|||
db_alias = schema_editor.connection.alias |
|||
EMailAddress = apps.get_model("users", "EMailAddress") |
|||
EMailAddress.objects.using(db_alias).delete() |
|||
|
|||
dependencies = [ |
|||
('users', '0072_auto_20180426_2021'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='EMailAddress', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('local_part', models.CharField(help_text="Local part of the email address", max_length=128, unique=True)), |
|||
('user', models.ForeignKey(help_text='User of the local email', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), |
|||
], |
|||
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model), |
|||
options={'permissions': (('view_emailaddress', 'Can see a local email account object'),), 'verbose_name': 'Local email account', 'verbose_name_plural': 'Local email accounts'}, |
|||
), |
|||
migrations.AddField( |
|||
model_name='user', |
|||
name='local_email_enabled', |
|||
field=models.BooleanField(default=False, help_text="Wether or not to enable the local email account."), |
|||
), |
|||
migrations.AddField( |
|||
model_name='user', |
|||
name='local_email_redirect', |
|||
field=models.BooleanField(default=False, help_text='Whether or not to redirect the local email messages to the main email.'), |
|||
), |
|||
migrations.RunPython(create_initial_email_address, |
|||
delete_all_email_address), |
|||
] |
|||
|
|||
@ -0,0 +1,56 @@ |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
|
|||
{% load acl %} |
|||
{% load logs_extra %} |
|||
|
|||
{% if emailaddress_list.paginator %} |
|||
{% include "pagination.html" with list=emailaddress_list %} |
|||
{% endif %} |
|||
|
|||
<table class="table table-striped"> |
|||
<thead> |
|||
<tr> |
|||
<th>Email address</th> |
|||
<th></th> |
|||
</tr> |
|||
</thead> |
|||
{% for emailaddress in emailaddress_list %} |
|||
<td>{{ emailaddress.complete_email_address }}</td> |
|||
<td class="text-right"> |
|||
{% can_delete emailaddress %} |
|||
{% include 'buttons/suppr.html' with href='users:del-emailaddress' id=emailaddress.id %} |
|||
{% acl_end %} |
|||
{% can_edit emailaddress %} |
|||
{% include 'buttons/edit.html' with href='users:edit-emailaddress' id=emailaddress.id %} |
|||
{% acl_end %} |
|||
{% history_button emailaddress %} |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</table> |
|||
|
|||
{% if emailaddress_list.paginator %} |
|||
{% include "pagination.html" with list=emailaddress_list %} |
|||
{% endif %} |
|||
@ -0,0 +1,34 @@ |
|||
{% extends "users/sidebar.html" %} |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
|
|||
{% load bootstrap3 %} |
|||
|
|||
{% block title %}Local email accounts{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h2>Local email accounts</h2> |
|||
{% include "users/aff_emailaddress.html" with emailaddress_list=emailaddress_list %} |
|||
{% endblock %} |
|||
|
|||
Loading…
Reference in new issue