core: make group_attributes include user's attributes

This commit is contained in:
Jens Langhammer 2020-09-30 11:39:25 +02:00
parent 9d5dd896f3
commit 59dbc15be7
1 changed files with 3 additions and 1 deletions

View File

@ -82,10 +82,12 @@ class User(GuardianUserMixin, AbstractUser):
objects = UserManager() objects = UserManager()
def group_attributes(self) -> Dict[str, Any]: def group_attributes(self) -> Dict[str, Any]:
"""Get a dictionary containing the attributes from all groups the user belongs to""" """Get a dictionary containing the attributes from all groups the user belongs to,
including the users attributes"""
final_attributes = {} final_attributes = {}
for group in self.pb_groups.all().order_by("name"): for group in self.pb_groups.all().order_by("name"):
final_attributes.update(group.attributes) final_attributes.update(group.attributes)
final_attributes.update(self.attributes)
return final_attributes return final_attributes
@cached_property @cached_property