From 439f1fefe29d986d91b21e6ae34da53a72d8a3b8 Mon Sep 17 00:00:00 2001 From: William MARTIN Date: Thu, 6 Jan 2011 11:13:29 +0100 Subject: [PATCH] Fix issue 588 : Redirect connected user to the anonymous url if they don't have register a SSH Key for GIT --- src/IDF/Scm/Git.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index ca05429..edc1aab 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -280,6 +280,14 @@ class IDF_Scm_Git extends IDF_Scm public static function getAuthAccessUrl($project, $user, $commit=null) { + // if the user haven't registred a public ssh key, + // he can't use the write url which use the SSH authentification + if ($user != null) { + $keys = $user->get_idf_key_list(); + if (count ($keys) == 0) + return self::getAnonymousAccessUrl($project); + } + return sprintf(Pluf::f('git_write_remote_url'), $project->shortname); }