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

View File

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

View File

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