Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/librit/passhport
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphux committed Nov 7, 2017
2 parents 47e4cda + 38836c2 commit 47d0b69
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
16 changes: 8 additions & 8 deletions docs/po/fr/LC_MESSAGES/introduction.po
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ msgid ""
msgstr ""
"PaSSHport est un logiciel qui vous permet de contrôler les accès SSH des "
"briques de votre IT : serveurs Linux/Unix, switchs réseaux, routeurs, "
"points d'accès WiFi, ainsi que n'importe quelle brique accessible via "
"SSH. En quatre mots : qui a accès à quoi ?"
"points d'accès Wi-Fi, ainsi que n'importe quelle brique accessible via "
"SSH. En quelques mots : qui a accès à quoi ?"

#: ../../introduction.rst:10
msgid "PaSSHport has been written with the following in mind :"
msgstr "PaSSHport a été écrit avec les objectifs suivants : "

#: ../../introduction.rst:12
msgid "Similar to `SSHgate <https://github.com/Tauop/sshGate>`_"
msgstr "Similaire à `SSHgate <https://github.com/Tauop/sshGate>`_"
msgstr "Même principes que `SSHgate <https://github.com/Tauop/sshGate>`_"

#: ../../introduction.rst:13
msgid "Two main objects : targets and users (we'll see below what are those)"
msgstr "Deux types d'objects : targets et users (Nous verrons ça un peu plus bas)"
msgstr "Deux types d'objets : targets et users (Nous verrons ça un peu plus bas)"

#: ../../introduction.rst:14
msgid "Objects can be grouped : targetgroups and usergroups"
msgstr "Les objects peuvent être groupés"
msgstr "Les objets peuvent être groupés"

#: ../../introduction.rst:15
msgid "Record all sessions of users"
Expand All @@ -61,7 +61,7 @@ msgstr "Être entièrement configurable et utilisable depuis la ligne de command

#: ../../introduction.rst:17
msgid "Can do Secured Copy (scp)"
msgstr "Possibilité de faire des copy sécurisées (scp)"
msgstr "Possibilité de faire des copies sécurisées (scp)"

#: ../../introduction.rst:18
msgid ""
Expand All @@ -73,7 +73,7 @@ msgstr ""

#: ../../introduction.rst:19
msgid "Use only OpenSource technologies"
msgstr "Utiliser seulement (ou principalement) des technologies OpenSource"
msgstr "Utiliser des technologies OpenSource"

#: ../../introduction.rst:21
msgid ""
Expand All @@ -93,7 +93,7 @@ msgstr "PaSSHport est composé de 3 programmes :"

#: ../../introduction.rst:27
msgid "passhportd : the daemon that verify access rights, and store configuration"
msgstr "passhportd : le démon qui enregistrent, et vérifie la configuration"
msgstr "passhportd : le démon qui enregistre, et vérifie la configuration"

#: ../../introduction.rst:28
msgid ""
Expand Down
3 changes: 2 additions & 1 deletion passhport/passhport
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ if __name__ == '__main__':
target_list = get(url_passhport + "user" + "/accessible_targets/" + \
username).split("\n")
except AttributeError as e:
sys.exit("No user exists in database.")
sys.exit("No user exists in database or can't reach passhportd.\n" +
"tip: it can be a SSL certificate misconfiguration.")
originalcmd = os.environ.get('SSH_ORIGINAL_COMMAND')
choice = 0

Expand Down
2 changes: 1 addition & 1 deletion passhportd/app/models_mod/targetgroup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def accessible_target_list(self, parsed_targetgroups = None, style="object"):

def all_targetname_list(self, parsed_targetgroups = None):
"""Return a list with all the targets of this targetgroup"""
return accessible_target_list(parsed_targetgroups, style="names")
return self.accessible_target_list(parsed_targetgroups, style="names")


# Usergroup management
Expand Down
9 changes: 9 additions & 0 deletions passhportd/app/models_mod/usergroup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Usergroup(db.Model):
# Relations
members = db.relationship("User", secondary="group_user")
targets = db.relationship("Target", secondary="target_group")
tgmembers = db.relationship("Targetgroup", secondary="tgroup_group")
gmembers = db.relationship(
"Usergroup",
secondary=group_of_group,
Expand Down Expand Up @@ -248,6 +249,7 @@ def list_direct_usergroups(self):

return usergroups


def accessible_target_list(self, checked_usergroups = []):
"""Return all the targets this usergroups give access to"""
accessible_targets = []
Expand All @@ -265,8 +267,15 @@ def accessible_target_list(self, checked_usergroups = []):
if target not in self.targets:
accessible_targets.append(target)

# 3. list all the target accessible through targetgroups
for targetgroup in self.tgmembers:
for target in targetgroup.accessible_target_list():
if target not in self.targets:
accessible_targets.append(target)

return accessible_targets


def show_targets(self, indentation):
"""Return all targets the group gives access
First the targets with this group attached
Expand Down

0 comments on commit 47d0b69

Please sign in to comment.