core: add user UID to API

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-05 11:48:16 +02:00
parent 2cad9a3d07
commit 446f104c90
3 changed files with 8 additions and 2 deletions

View File

@ -42,6 +42,7 @@ class UserSerializer(ModelSerializer):
avatar = CharField(read_only=True)
attributes = JSONField(validators=[is_dict], required=False)
groups = ListSerializer(child=GroupSerializer(), read_only=True, source="ak_groups")
uid = CharField(read_only=True)
class Meta:
@ -57,6 +58,7 @@ class UserSerializer(ModelSerializer):
"email",
"avatar",
"attributes",
"uid",
]

View File

@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"net"
"strconv"
"strings"
"github.com/nmcclain/ldap"
@ -79,7 +78,7 @@ func (pi *ProviderInstance) Search(bindDN string, searchReq ldap.SearchRequest,
},
{
Name: "uid",
Values: []string{strconv.Itoa(int(u.Pk))},
Values: []string{u.UID},
},
{
Name: "name",

View File

@ -15395,6 +15395,11 @@ definitions:
attributes:
title: Attributes
type: object
uid:
title: Uid
type: string
readOnly: true
minLength: 1
Token:
required:
- identifier