mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-09 03:16:25 +00:00
Serialisation des alias mail
This commit is contained in:
parent
024d7a073c
commit
b7977f493b
3 changed files with 24 additions and 1 deletions
|
@ -492,10 +492,12 @@ class UserSerializer(NamespacedHMSerializer):
|
||||||
"""
|
"""
|
||||||
access = serializers.BooleanField(source='has_access')
|
access = serializers.BooleanField(source='has_access')
|
||||||
uid = serializers.IntegerField(source='uid_number')
|
uid = serializers.IntegerField(source='uid_number')
|
||||||
|
email = serializers.CharField(source='get_mail')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = users.User
|
model = users.User
|
||||||
fields = ('name', 'pseudo', 'email', 'school', 'shell', 'comment',
|
fields = ('name', 'pseudo', 'email', 'school', 'shell', 'comment',
|
||||||
|
'external_mail', 'redirection', 'internal_address',
|
||||||
'state', 'registered', 'telephone', 'solde', 'access',
|
'state', 'registered', 'telephone', 'solde', 'access',
|
||||||
'end_access', 'uid', 'class_name', 'api_url')
|
'end_access', 'uid', 'class_name', 'api_url')
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
|
@ -509,10 +511,12 @@ class ClubSerializer(NamespacedHMSerializer):
|
||||||
name = serializers.CharField(source='surname')
|
name = serializers.CharField(source='surname')
|
||||||
access = serializers.BooleanField(source='has_access')
|
access = serializers.BooleanField(source='has_access')
|
||||||
uid = serializers.IntegerField(source='uid_number')
|
uid = serializers.IntegerField(source='uid_number')
|
||||||
|
email = serializers.CharField(source='get_mail')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = users.Club
|
model = users.Club
|
||||||
fields = ('name', 'pseudo', 'email', 'school', 'shell', 'comment',
|
fields = ('name', 'pseudo', 'email', 'school', 'shell', 'comment',
|
||||||
|
'external_mail', 'redirection', 'internal_address',
|
||||||
'state', 'registered', 'telephone', 'solde', 'room',
|
'state', 'registered', 'telephone', 'solde', 'room',
|
||||||
'access', 'end_access', 'administrators', 'members',
|
'access', 'end_access', 'administrators', 'members',
|
||||||
'mailing', 'uid', 'api_url')
|
'mailing', 'uid', 'api_url')
|
||||||
|
@ -526,10 +530,12 @@ class AdherentSerializer(NamespacedHMSerializer):
|
||||||
"""
|
"""
|
||||||
access = serializers.BooleanField(source='has_access')
|
access = serializers.BooleanField(source='has_access')
|
||||||
uid = serializers.IntegerField(source='uid_number')
|
uid = serializers.IntegerField(source='uid_number')
|
||||||
|
email = serializers.CharField(source='get_mail')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = users.Adherent
|
model = users.Adherent
|
||||||
fields = ('name', 'surname', 'pseudo', 'email', 'school', 'shell',
|
fields = ('name', 'surname', 'pseudo', 'email', 'redirection', 'internal_address',
|
||||||
|
'external_mail', 'school', 'shell',
|
||||||
'comment', 'state', 'registered', 'telephone', 'room',
|
'comment', 'state', 'registered', 'telephone', 'room',
|
||||||
'solde', 'access', 'end_access', 'uid', 'api_url')
|
'solde', 'access', 'end_access', 'uid', 'api_url')
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
|
@ -593,6 +599,15 @@ class WhitelistSerializer(NamespacedHMSerializer):
|
||||||
fields = ('user', 'raison', 'date_start', 'date_end', 'active', 'api_url')
|
fields = ('user', 'raison', 'date_start', 'date_end', 'active', 'api_url')
|
||||||
|
|
||||||
|
|
||||||
|
class MailAliasSerializer(NamespacedHMSerializer):
|
||||||
|
"""Serialize `users.models.MailAlias` objects.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = users.MailAlias
|
||||||
|
fields = ('user', 'valeur', 'complete_mail')
|
||||||
|
|
||||||
|
|
||||||
# SERVICE REGEN
|
# SERVICE REGEN
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ router.register_viewset(r'users/listright', views.ListRightViewSet)
|
||||||
router.register_viewset(r'users/shell', views.ShellViewSet, base_name='shell')
|
router.register_viewset(r'users/shell', views.ShellViewSet, base_name='shell')
|
||||||
router.register_viewset(r'users/ban', views.BanViewSet)
|
router.register_viewset(r'users/ban', views.BanViewSet)
|
||||||
router.register_viewset(r'users/whitelist', views.WhitelistViewSet)
|
router.register_viewset(r'users/whitelist', views.WhitelistViewSet)
|
||||||
|
router.register_viewset(r'users/mailalias', views.MailAliasViewSet)
|
||||||
# SERVICE REGEN
|
# SERVICE REGEN
|
||||||
router.register_viewset(r'services/regen', views.ServiceRegenViewSet, base_name='serviceregen')
|
router.register_viewset(r'services/regen', views.ServiceRegenViewSet, base_name='serviceregen')
|
||||||
# DHCP
|
# DHCP
|
||||||
|
|
|
@ -469,6 +469,13 @@ class WhitelistViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
serializer_class = serializers.WhitelistSerializer
|
serializer_class = serializers.WhitelistSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class MailAliasViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
|
"""Exposes list and details of `users.models.MailAlias` objects.
|
||||||
|
"""
|
||||||
|
queryset = users.MailAlias.objects.all()
|
||||||
|
serializer_class = serializers.MailAliasSerializer
|
||||||
|
|
||||||
|
|
||||||
# SERVICE REGEN
|
# SERVICE REGEN
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue