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