diff --git a/selfprivacy_api/models/group.py b/selfprivacy_api/models/group.py index 0328690..96422d3 100644 --- a/selfprivacy_api/models/group.py +++ b/selfprivacy_api/models/group.py @@ -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]]): diff --git a/selfprivacy_api/repositories/users/kanidm_user_repository.py b/selfprivacy_api/repositories/users/kanidm_user_repository.py index 9d8303b..621dda9 100644 --- a/selfprivacy_api/repositories/users/kanidm_user_repository.py +++ b/selfprivacy_api/repositories/users/kanidm_user_repository.py @@ -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", []),