Fix issue 588 : Redirect connected user to the anonymous url if they don't have register a SSH Key for GIT

This commit is contained in:
William MARTIN 2011-01-06 11:13:29 +01:00
parent 4245617c6f
commit 439f1fefe2

View File

@ -280,6 +280,14 @@ class IDF_Scm_Git extends IDF_Scm
public static function getAuthAccessUrl($project, $user, $commit=null) 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); return sprintf(Pluf::f('git_write_remote_url'), $project->shortname);
} }