mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-07 02:16:26 +00:00
Merge branch 'users_base_serialize' into 'dev'
Export users basic et critical See merge request federez/re2o!357
This commit is contained in:
commit
57a14afe0b
3 changed files with 17 additions and 4 deletions
|
@ -632,9 +632,8 @@ class AdherentSerializer(NamespacedHMSerializer):
|
|||
}
|
||||
|
||||
|
||||
class HomeCreationSerializer(NamespacedHMSerializer):
|
||||
"""Serialize 'users.models.User' minimal infos to create home
|
||||
"""
|
||||
class BasicUserSerializer(NamespacedHMSerializer):
|
||||
"""Serialize 'users.models.User' minimal infos"""
|
||||
uid = serializers.IntegerField(source='uid_number')
|
||||
gid = serializers.IntegerField(source='gid_number')
|
||||
|
||||
|
|
|
@ -88,6 +88,8 @@ router.register(r'topologie/portprofile', views.PortProfileViewSet)
|
|||
# USERS
|
||||
router.register_viewset(r'users/user', views.UserViewSet, base_name='user')
|
||||
router.register_viewset(r'users/homecreation', views.HomeCreationViewSet, base_name='homecreation')
|
||||
router.register_viewset(r'users/normaluser', views.NormalUserViewSet, base_name='normaluser')
|
||||
router.register_viewset(r'users/criticaluser', views.CriticalUserViewSet, base_name='criticaluser')
|
||||
router.register_viewset(r'users/club', views.ClubViewSet)
|
||||
router.register_viewset(r'users/adherent', views.AdherentViewSet)
|
||||
router.register_viewset(r'users/serviceuser', views.ServiceUserViewSet)
|
||||
|
|
14
api/views.py
14
api/views.py
|
@ -445,7 +445,19 @@ class HomeCreationViewSet(viewsets.ReadOnlyModelViewSet):
|
|||
"""Exposes infos of `users.models.Users` objects to create homes.
|
||||
"""
|
||||
queryset = users.User.objects.exclude(Q(state=users.User.STATE_DISABLED) | Q(state=users.User.STATE_NOT_YET_ACTIVE))
|
||||
serializer_class = serializers.HomeCreationSerializer
|
||||
serializer_class = serializers.BasicUserSerializer
|
||||
|
||||
|
||||
class NormalUserViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
"""Exposes infos of `users.models.Users`without specific rights objects."""
|
||||
queryset = users.User.objects.exclude(groups__listright__critical=True).distinct()
|
||||
serializer_class = serializers.BasicUserSerializer
|
||||
|
||||
|
||||
class CriticalUserViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
"""Exposes infos of `users.models.Users`without specific rights objects."""
|
||||
queryset = users.User.objects.filter(groups__listright__critical=True).distinct()
|
||||
serializer_class = serializers.BasicUserSerializer
|
||||
|
||||
|
||||
class ClubViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
|
|
Loading…
Reference in a new issue