Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
4f2c1dcb
Commit
4f2c1dcb
authored
Jan 04, 2019
by
chirac
Browse files
Merge branch 'hotfix_serializer' into 'dev'
Fix crash of optionaltopologie serializer See merge request federez/re2o!386
parents
05cdb751
edf89dac
Pipeline
#931
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
api/serializers.py
View file @
4f2c1dcb
...
...
@@ -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.
"""
...
...
api/urls.py
View file @
4f2c1dcb
...
...
@@ -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
),
...
...
api/views.py
View file @
4f2c1dcb
...
...
@@ -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.
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment