diff --git a/src/IDF/Project.php b/src/IDF/Project.php index 1e2e810..7c0f37b 100644 --- a/src/IDF/Project.php +++ b/src/IDF/Project.php @@ -350,8 +350,27 @@ class IDF_Project extends Pluf_Model } /** + * Get the access url to the repository. + * + * This will return the right url based on the user. + * + * @param Pluf_User The user (null) + */ + public function getSourceAccessUrl($user=null) + { + $right = $this->getConf()->getVal('source_access_rights', 'all'); + if (($user == null or $user->isAnonymous()) + and $right == 'all' and !$this->private) { + return $this->getRemoteAccessUrl(); + } + return $this->getWriteRemoteAccessUrl($user); + } + + + /** * Get the remote access url to the repository. * + * This will always return the anonymous access url. */ public function getRemoteAccessUrl() { diff --git a/src/IDF/templates/idf/source/git/help.html b/src/IDF/templates/idf/source/git/help.html index de939c9..9e72ba9 100644 --- a/src/IDF/templates/idf/source/git/help.html +++ b/src/IDF/templates/idf/source/git/help.html @@ -8,7 +8,7 @@ code.{/blocktrans}

{trans 'Command-Line Access'}

-

git clone {if $project.private}{$project.getWriteRemoteAccessUrl($user)}{else}{$project.getRemoteAccessUrl()}{/if}

+

git clone {$project.getSourceAccessUrl($user)}

{aurl 'url', 'IDF_Views_User::myAccount'}

{blocktrans}You may need to provide your SSH key. The synchronization of your SSH key can take a couple of minutes. You can learn more about SSH key authentification.{/blocktrans}

diff --git a/src/IDF/templates/idf/source/git/tree.html b/src/IDF/templates/idf/source/git/tree.html index 58755e5..b97db05 100644 --- a/src/IDF/templates/idf/source/git/tree.html +++ b/src/IDF/templates/idf/source/git/tree.html @@ -47,7 +47,7 @@ {aurl 'url', 'IDF_Views_Source::download', array($project.shortname, $commit)} -

{trans 'Archive'} {trans 'Download this version'} {trans 'or'} git clone {if $project.private}{$project.getWriteRemoteAccessUrl($user)}{else}{$project.getRemoteAccessUrl()}{/if} {trans 'Help'}

+

{trans 'Archive'} {trans 'Download this version'} {trans 'or'} git clone {$project.getSourceAccessUrl($user)} {trans 'Help'}

{/block}