mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-21 19:03:11 +00:00
Fix crash of optionaltopologie serializer
This commit is contained in:
parent
05cdb751e4
commit
edf89dac98
3 changed files with 26 additions and 2 deletions
|
@ -391,13 +391,25 @@ class OptionalTopologieSerializer(NamespacedHMSerializer):
|
|||
|
||||
class Meta:
|
||||
model = preferences.OptionalTopologie
|
||||
fields = ('radius_general_policy', 'vlan_decision_ok',
|
||||
'vlan_decision_nok', 'switchs_ip_type', 'switchs_web_management',
|
||||
fields = ('switchs_ip_type', 'switchs_web_management',
|
||||
'switchs_web_management_ssl', 'switchs_rest_management',
|
||||
'switchs_management_utils', 'switchs_management_interface_ip',
|
||||
'provision_switchs_enabled', 'switchs_provision', 'switchs_management_sftp_creds')
|
||||
|
||||
|
||||
class RadiusOptionSerializer(NamespacedHMSerializer):
|
||||
"""Serialize `preferences.models.RadiusOption` objects
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = preferences.RadiusOption
|
||||
fields = ('radius_general_policy', 'unknown_machine',
|
||||
'unknown_machine_vlan', 'unknown_port',
|
||||
'unknown_port_vlan', 'unknown_room', 'unknown_room_vlan',
|
||||
'non_member', 'non_member_vlan', 'banned', 'banned_vlan',
|
||||
'vlan_decision_ok')
|
||||
|
||||
|
||||
class GeneralOptionSerializer(NamespacedHMSerializer):
|
||||
"""Serialize `preferences.models.GeneralOption` objects.
|
||||
"""
|
||||
|
|
|
@ -67,6 +67,7 @@ router.register_viewset(r'machines/role', views.RoleViewSet)
|
|||
router.register_view(r'preferences/optionaluser', views.OptionalUserView),
|
||||
router.register_view(r'preferences/optionalmachine', views.OptionalMachineView),
|
||||
router.register_view(r'preferences/optionaltopologie', views.OptionalTopologieView),
|
||||
router.register_view(r'preferences/radiusoption', views.RadiusOptionView),
|
||||
router.register_view(r'preferences/generaloption', views.GeneralOptionView),
|
||||
router.register_viewset(r'preferences/service', views.HomeServiceViewSet, base_name='homeservice'),
|
||||
router.register_view(r'preferences/assooption', views.AssoOptionView),
|
||||
|
|
11
api/views.py
11
api/views.py
|
@ -292,6 +292,17 @@ class OptionalTopologieView(generics.RetrieveAPIView):
|
|||
return preferences.OptionalTopologie.objects.first()
|
||||
|
||||
|
||||
class RadiusOptionView(generics.RetrieveAPIView):
|
||||
"""Exposes details of `preferences.models.OptionalTopologie` settings.
|
||||
"""
|
||||
permission_classes = (ACLPermission,)
|
||||
perms_map = {'GET': [preferences.RadiusOption.can_view_all]}
|
||||
serializer_class = serializers.RadiusOptionSerializer
|
||||
|
||||
def get_object(self):
|
||||
return preferences.RadiusOption.objects.first()
|
||||
|
||||
|
||||
class GeneralOptionView(generics.RetrieveAPIView):
|
||||
"""Exposes details of `preferences.models.GeneralOption` settings.
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue