Skip to content

Commit

Permalink
Merge pull request #383 from Aguay-val/master
Browse files Browse the repository at this point in the history
fix(models_mod/user.py): Fix simplejson def
  • Loading branch information
elg authored Jun 27, 2019
2 parents 438bc40 + 427da23 commit cdd49e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions passhportd/app/models_mod/targetgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def simplejson(self):
output = "{\n"

output = output + "\"Name\": \"" + format(self.name) + "\",\n"
output = output + "\"Comment\": \"" + format(self.comment) + "\",\n"
output = output + "\"Comment\": \"" + format(self.comment) + "\"\n"
output = output + "}"

return output
Expand Down Expand Up @@ -109,7 +109,7 @@ def prepare_delete(self):
self.tgadmins.pop()

return self


# User management
def is_members(self, user):
Expand Down Expand Up @@ -288,7 +288,7 @@ def accessible_target_list(self, parsed_targetgroups = None, style="object"):
style = "object"):
if target not in targets:
targets.append(target)
# Return target objects or names depending of the style
# Return target objects or names depending of the style
if style == "names":
targetnames = []
for target in targets:
Expand Down Expand Up @@ -386,7 +386,7 @@ def addtargetgroup(self, targetgroup):
"""Add a targetgroup to the relaton table"""
if not self.is_tgmembers(targetgroup) and not self == targetgroup:
self.tgmembers.append(targetgroup)
else:
else:
return False

return self
Expand All @@ -410,7 +410,7 @@ def memberof(self, obj):
members.append(targetgroup)
else:
return "Error in object type"

ret = "["
for m in members:
ret = ret + m.name + ","
Expand Down Expand Up @@ -456,11 +456,11 @@ def all_targetgroupname_list(self, parsed_targetgroups = None):
return targetgroupnames

def show_targets(self, indentation):
"""Return a formated list of the targets that the targetgroup
"""Return a formated list of the targets that the targetgroup
provides
"""
listing = []

indent = ""
for i in range(indentation):
indent = indent + " "
Expand Down
2 changes: 1 addition & 1 deletion passhportd/app/models_mod/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def simplejson(self):
format(self.show_sshkeyhash()) + "\",\n"
output = output + "\"logfilesize\": \"" + \
format(self.show_logfilesize()) + "\",\n"
output = output + "\"comment\": \"" + format(self.comment) + "\",\n"
output = output + "\"comment\": \"" + format(self.comment) + "\"\n"
output = output + "}"

return output
Expand Down
14 changes: 7 additions & 7 deletions passhportd/app/models_mod/usergroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def simplejson(self):
output = output + "\"Name\": \"" + format(self.name) + "\",\n"
output = output + "\"Comment\": \"" + format(self.comment) + "\",\n"
output = output + "\"Directsize\": \"" + format(str(directsize)) + "\",\n"
output = output + "\"Totalsize\": \"" + format(str(totalsize)) + "\",\n"
output = output + "\"Totalsize\": \"" + format(str(totalsize)) + "\"\n"
output = output + "}"

return output
Expand All @@ -80,7 +80,7 @@ def simplejson(self):
def show_name(self):
"""Return a string containing the usergroup's name"""
return self.name


def show_comment(self):
"""Return a string containing the usergroup's comment"""
Expand Down Expand Up @@ -189,7 +189,7 @@ def all_username_list(self, parsed_usergroups = []):
"""
usernames = self.username_list()

# Recursive on groups:
# Recursive on groups:
# we list all usernames but we never parse a group twice
# to avoid cirular issues.
for usergroup in self.gmembers:
Expand Down Expand Up @@ -217,7 +217,7 @@ def memberof(self, obj):
members.append(usergroup)
else:
return "Error in object type"

ret = "["
for m in members:
ret = ret + m.name + ","
Expand Down Expand Up @@ -278,7 +278,7 @@ def all_usergroupname_list(self, parsed_usergroups = []):
in the usergroup
"""
usergroupnames = self.usergroupname_list() # ["G1","G2"]

# Recursive on usergroups:
# we list all usergroups but we never parse a group twice
# to avoid cirular issues.
Expand Down Expand Up @@ -356,7 +356,7 @@ def accessible_target_list(self, checked_usergroups = [], mode="string"):
checked_usergroups.append(usergroup)
for target in usergroup.accessible_target_list(checked_usergroups):
if target not in self.targets:
if mode == "string":
if mode == "string":
accessible_targets.append(target.name)
else:
accessible_targets.append(target)
Expand All @@ -377,7 +377,7 @@ def show_targets(self, indentation):
"""Return all targets the group gives access
First the targets with this group attached
Then targets from targetgroups with this group attached
Then targets from groups with this group attached
Then targets from groups with this group attached
Finally We relaunch this on the groups with this groups attached
"""
listing = []
Expand Down

0 comments on commit cdd49e4

Please sign in to comment.