add user auth only to hidden projects

This commit is contained in:
Alexander Machehin 2012-12-18 17:15:45 +06:00
parent 12b8b4c612
commit e658f8765e
1 changed files with 2 additions and 1 deletions

View File

@ -120,7 +120,8 @@ class Project < ActiveRecord::Base
def git_project_address auth_user
host ||= EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
protocol = APP_CONFIG['mailer_https_url'] ? "https" : "http" rescue "http"
opts = {:host => host, :protocol => protocol, :user => auth_user.authentication_token, :password => ''}
opts = {:host => host, :protocol => protocol}
opts.merge!({:user => auth_user.authentication_token, :password => ''}) unless self.public?
Rails.application.routes.url_helpers.project_url(self.owner.uname, self.name, opts) + ".git"
#path #share by NFS
end