2016-05-10 23:22:22 +02:00
|
|
|
"""
|
|
|
|
.. module: lemur.roles.schemas
|
|
|
|
:platform: unix
|
2018-05-29 19:18:16 +02:00
|
|
|
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
|
2016-05-10 23:22:22 +02:00
|
|
|
:license: Apache, see LICENSE for more details.
|
|
|
|
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
|
|
|
"""
|
|
|
|
from marshmallow import fields
|
2016-05-16 18:23:48 +02:00
|
|
|
from lemur.users.schemas import UserNestedOutputSchema
|
2016-06-03 17:28:09 +02:00
|
|
|
from lemur.authorities.schemas import AuthorityNestedOutputSchema
|
2016-05-10 23:22:22 +02:00
|
|
|
from lemur.common.schema import LemurInputSchema, LemurOutputSchema
|
|
|
|
from lemur.schemas import AssociatedUserSchema, AssociatedAuthoritySchema
|
|
|
|
|
|
|
|
|
|
|
|
class RoleInputSchema(LemurInputSchema):
|
2016-05-12 21:38:44 +02:00
|
|
|
id = fields.Integer()
|
2016-05-10 23:22:22 +02:00
|
|
|
name = fields.String(required=True)
|
|
|
|
username = fields.String()
|
|
|
|
password = fields.String()
|
|
|
|
description = fields.String()
|
|
|
|
authorities = fields.Nested(AssociatedAuthoritySchema, many=True)
|
|
|
|
users = fields.Nested(AssociatedUserSchema, many=True)
|
|
|
|
|
|
|
|
|
|
|
|
class RoleOutputSchema(LemurOutputSchema):
|
2016-05-12 21:38:44 +02:00
|
|
|
id = fields.Integer()
|
2016-05-10 23:22:22 +02:00
|
|
|
name = fields.String()
|
|
|
|
description = fields.String()
|
2017-12-11 22:51:45 +01:00
|
|
|
third_party = fields.Boolean()
|
2016-06-03 17:28:09 +02:00
|
|
|
authorities = fields.Nested(AuthorityNestedOutputSchema, many=True)
|
2016-05-16 18:23:48 +02:00
|
|
|
users = fields.Nested(UserNestedOutputSchema, many=True)
|
2016-05-10 23:22:22 +02:00
|
|
|
|
|
|
|
|
2016-05-20 21:48:12 +02:00
|
|
|
class RoleNestedOutputSchema(LemurOutputSchema):
|
|
|
|
__envelope__ = False
|
|
|
|
id = fields.Integer()
|
|
|
|
name = fields.String()
|
|
|
|
description = fields.String()
|
|
|
|
|
|
|
|
|
2016-05-10 23:22:22 +02:00
|
|
|
role_input_schema = RoleInputSchema()
|
|
|
|
role_output_schema = RoleOutputSchema()
|
|
|
|
roles_output_schema = RoleOutputSchema(many=True)
|