fix: from review

This commit is contained in:
dettlaff 2024-12-30 05:41:56 +04:00
parent b83a448e94
commit 4e1d9076e2
2 changed files with 9 additions and 5 deletions

View file

@ -14,7 +14,7 @@ class Group(BaseModel):
group or assign it different roles/categories. Defaults to an empty list.
member (Optional[list[str]]):
A list of members who belong to the group.
A list of the groups within a given group.
Optional, defaults to an empty list.
memberof (Optional[list[str]]):

View file

@ -32,7 +32,7 @@ from selfprivacy_api.repositories.users.abstract_user_repository import (
REDIS_TOKEN_KEY = "kanidm:token"
KANIDM_URL = "https://127.0.0.1:3013"
ADMIN_GROUPS = ["sp.admin"]
ADMIN_GROUPS = ["sp.admins"]
redis = RedisPool().get_connection()
@ -403,11 +403,11 @@ class KanidmUserRepository(AbstractUserRepository):
filled_user = UserDataUser(
username=user_attrs["name"][0],
user_type=user_type,
ssh_keys=[], # actions layer will full in this field
ssh_keys=[], # actions layer will fill in this field
directmemberof=user_attrs.get("directmemberof", []),
memberof=user_attrs.get("memberof", []),
displayname=user_attrs.get("displayname", None)[0],
email=user_attrs.get("mail", None)[0],
displayname=user_attrs.get("displayname", [None])[0],
email=user_attrs.get("mail", [None])[0],
)
users.append(filled_user)
@ -600,6 +600,10 @@ class KanidmUserRepository(AbstractUserRepository):
groups = []
for group_data in groups_list_data:
attrs = group_data.get("attrs", {})
if "builtin" in attrs.get("class", []):
continue
group = Group(
name=attrs["name"][0],
group_class=attrs.get("class", []),