<commit_before>from radar_api.serializers.groups import GroupReferenceField
from radar_api.serializers.meta import MetaSerializerMixin
from radar_api.serializers.user_mixins import UserSerializerMixin
from radar.models.groups import GroupUser
from radar.roles import ROLE, ROLE_NAMES
from radar.serializers.fields import ListField, StringField
from radar.serializers.models import ModelSerializer
from radar.serializers.fields import LabelledEnumField


class GroupUserSerializer(UserSerializerMixin, MetaSerializerMixin, ModelSerializer):
    group = GroupReferenceField()
    role = LabelledEnumField(ROLE, ROLE_NAMES)
    permissions = ListField(StringField(), read_only=True)

    class Meta(object):
        model_class = GroupUser
        exclude = ['user_id', 'group_id']<commit_msg>Add managed roles to serializer<commit_after>from radar_api.serializers.groups import GroupReferenceField
from radar_api.serializers.meta import MetaSerializerMixin
from radar_api.serializers.user_mixins import UserSerializerMixin
from radar.models.groups import GroupUser
from radar.roles import ROLE, ROLE_NAMES
from radar.serializers.fields import ListField, StringField
from radar.serializers.models import ModelSerializer
from radar.serializers.fields import LabelledEnumField


class GroupUserSerializer(UserSerializerMixin, MetaSerializerMixin, ModelSerializer):
    group = GroupReferenceField()
    role = LabelledEnumField(ROLE, ROLE_NAMES)
    permissions = ListField(StringField(), read_only=True)
    managed_roles = ListField(StringField(), read_only=True)

    class Meta(object):
        model_class = GroupUser
        exclude = ['user_id', 'group_id']
{'fraction_non_alphanumeric': 0.06570223025919228, 'fraction_numerical': 0.0, 'mean_word_length': 6.312775330396476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2544083', 'n_tokens_mistral': 445, 'n_tokens_neox': 442, 'n_words': 112}