Skip to content

Commit

Permalink
🐛 Add missing self-titled user group
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Feb 23, 2024
1 parent b55d3a2 commit 52f4436
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apricot/models/ldap_posix_group.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pydantic import BaseModel, validator

ID_MIN = 3000
ID_MIN = 2000
ID_MAX = 4294967295


Expand Down
9 changes: 8 additions & 1 deletion apricot/oauth/oauth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ def validated_groups(self) -> list[LDAPAttributeDict]:
Validate output via pydantic and return a list of LDAPAttributeDict
"""
output = []
for group_dict in self.groups():
# Add one self-titled group for each user
user_group_dicts = []
for user_dict in self.users():
user_dict["memberUid"] = [user_dict["uid"]]
user_dict["member"] = [f"CN={user_dict['uid']},OU=users,{self.root_dn}"]
user_group_dicts.append(user_dict)
# Iterate over groups and validate them
for group_dict in self.groups() + user_group_dicts:
try:
attributes = {"objectclass": ["top"]}
# Add 'groupOfNames' attributes
Expand Down

0 comments on commit 52f4436

Please sign in to comment.