Apply suggestions from code review

Thank you Marius! way better :)

Co-authored-by: Marius van den Beek <m.vandenbeek@gmail.com>
This commit is contained in:
David López
2021-10-08 17:44:14 +02:00
committed by GitHub
co-authored by Marius van den Beek
parent eab03a0f97
commit e34546aec7
+2 -6
View File
@@ -250,17 +250,13 @@ class ProvidesUserFileSourcesUserContext:
def role_names(self) -> Set[str]:
"""The set of role names of this user."""
user = self.trans.user
if user is None:
return set()
return user and set([ura.role.name for ura in user.roles])
return set(ura.role.name for ura in user.roles) if user else set()
@property
def group_names(self) -> Set[str]:
"""The set of group names to which this user belongs."""
user = self.trans.user
if user is None:
return set()
return user and set([ugr.group.name for ugr in user.groups])
return set(ugr.group.name for ugr in user.groups) if user else set()
@property
def is_admin(self):