@@ -53,9 +53,9 @@ def groups(self) -> list[JSONDict]:
53
53
# If group_gid exists then set the cache to the same value
54
54
# This ensures that any groups without a `gid` attribute will receive a
55
55
# UID that does not overlap with existing groups
56
- if group_gid := group_dict ["attributes" ]["gid" ]:
56
+ if ( group_gid := group_dict ["attributes" ]["gid" ]) and len ( group_dict [ "attributes" ][ "gid" ]) == 1 :
57
57
self .uid_cache .overwrite_group_uid (
58
- group_dict ["id" ], int (group_gid , 10 )
58
+ group_dict ["id" ], int (group_gid [ 0 ] , 10 )
59
59
)
60
60
61
61
# Read group attributes
@@ -72,7 +72,7 @@ def groups(self) -> list[JSONDict]:
72
72
attributes : JSONDict = {}
73
73
attributes ["cn" ] = group_dict .get ("name" , None )
74
74
attributes ["description" ] = group_dict .get ("id" , None )
75
- attributes ["gidNumber" ] = group_dict ["attributes" ]["gid" ]
75
+ attributes ["gidNumber" ] = group_dict ["attributes" ]["gid" ][ 0 ]
76
76
attributes ["oauth_id" ] = group_dict .get ("id" , None )
77
77
# Add membership attributes
78
78
members = self .query (
@@ -107,9 +107,9 @@ def users(self) -> list[JSONDict]:
107
107
# If user_uid exists then set the cache to the same value.
108
108
# This ensures that any groups without a `gid` attribute will receive a
109
109
# UID that does not overlap with existing groups
110
- if user_uid := user_dict ["attributes" ]["uid" ]:
110
+ if ( user_uid := user_dict ["attributes" ]["uid" ]) and len ( user_dict [ "attributes" ][ "uid" ]) == 1 :
111
111
self .uid_cache .overwrite_user_uid (
112
- user_dict ["id" ], int (user_uid , 10 )
112
+ user_dict ["id" ], int (user_uid [ 0 ] , 10 )
113
113
)
114
114
115
115
# Read user attributes
@@ -139,12 +139,12 @@ def users(self) -> list[JSONDict]:
139
139
attributes ["displayName" ] = full_name
140
140
attributes ["mail" ] = user_dict .get ("email" )
141
141
attributes ["description" ] = ""
142
- attributes ["gidNumber" ] = user_dict ["attributes" ]["uid" ]
142
+ attributes ["gidNumber" ] = user_dict ["attributes" ]["uid" ][ 0 ]
143
143
attributes ["givenName" ] = first_name if first_name else ""
144
144
attributes ["homeDirectory" ] = f"/home/{ username } " if username else None
145
145
attributes ["oauth_id" ] = user_dict .get ("id" , None )
146
146
attributes ["sn" ] = last_name if last_name else ""
147
- attributes ["uidNumber" ] = user_dict ["attributes" ]["uid" ]
147
+ attributes ["uidNumber" ] = user_dict ["attributes" ]["uid" ][ 0 ]
148
148
output .append (attributes )
149
149
except KeyError :
150
150
pass
0 commit comments