diff --git a/docs/api.rst b/docs/api.rst index ac5792a2155b..1b4f0fbf5096 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -524,6 +524,7 @@ Groups :>json array components: link to associated components; see :http:get:`/api/components/(string:project)/(string:component)/` :>json array componentlists: link to associated componentlist; see :http:get:`/api/component-lists/(str:slug)/` :>json str defining_project: link to the defining project, used for :ref:`manage-acl`; see :http:get:`/api/projects/(string:project)/` + :>json array admins: link to associated administrators; see :http:get:`/api/users/(str:username)/` **Example JSON data:** @@ -550,6 +551,9 @@ Groups "componentlist": "http://example.com/api/component-lists/new/", "components": [ "http://example.com/api/components/demo/weblate/" + ], + "admins": [ + "http://example.com/api/users/exampleusername/" ] } diff --git a/docs/changes.rst b/docs/changes.rst index d498c0baa45f..61c8217c8922 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -7,6 +7,8 @@ Weblate 5.15 .. rubric:: Improvements +* :http:get:`/api/groups/` now includes ``admins``. + .. rubric:: Bug fixes .. rubric:: Compatibility diff --git a/docs/specs/openapi.yaml b/docs/specs/openapi.yaml index 2b257e209a7b..c7d11b445990 100644 --- a/docs/specs/openapi.yaml +++ b/docs/specs/openapi.yaml @@ -67825,7 +67825,14 @@ components: type: boolean title: Enforced two-factor authentication description: Requires users to have two-factor authentication configured. + admins: + type: array + items: + type: string + format: uri + readOnly: true required: + - admins - componentlists - components - id @@ -70503,6 +70510,12 @@ components: type: boolean title: Enforced two-factor authentication description: Requires users to have two-factor authentication configured. + admins: + type: array + items: + type: string + format: uri + readOnly: true PatchedLanguage: type: object properties: diff --git a/weblate/api/serializers.py b/weblate/api/serializers.py index 4eb9f1787393..f7e990a3e73c 100644 --- a/weblate/api/serializers.py +++ b/weblate/api/serializers.py @@ -464,6 +464,12 @@ class GroupSerializer(serializers.ModelSerializer[Group]): queryset=Project.objects.none(), required=False, ) + admins = serializers.HyperlinkedRelatedField( + view_name="api:user-detail", + lookup_field="username", + many=True, + read_only=True, + ) class Meta: model = Group @@ -480,6 +486,7 @@ class Meta: "componentlists", "components", "enforced_2fa", + "admins", ) extra_kwargs = { # noqa: RUF012 "url": {"view_name": "api:group-detail", "lookup_field": "id"},