core: make group_attributes include user's attributes
This commit is contained in:
parent
9d5dd896f3
commit
59dbc15be7
|
@ -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
|
||||||
|
|
Reference in New Issue