comparison app/controllers/sys_controller.rb @ 214:e0cbb39c0429 feature_73

* Add method to retrieve external repo URL (via /sys/projects/<id>/external-repository.xml?key=<key>)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 10 Feb 2011 14:40:44 +0000
parents 513646585e45
children 6c282df74a30
comparison
equal deleted inserted replaced
209:ff5112f823e5 214:e0cbb39c0429
53 render :nothing => true, :status => 200 53 render :nothing => true, :status => 200
54 rescue ActiveRecord::RecordNotFound 54 rescue ActiveRecord::RecordNotFound
55 render :nothing => true, :status => 404 55 render :nothing => true, :status => 404
56 end 56 end
57 57
58 def get_external_repo_url
59 project = Project.find(params[:id])
60 if project.repository
61 repo = project.repository
62 if repo.is_external?
63 render :text => repo.external_url, :status => 200
64 else
65 render :nothing => true, :status => 200
66 end
67 end
68 rescue ActiveRecord::RecordNotFound
69 render :nothing => true, :status => 404
70 end
71
58 protected 72 protected
59 73
60 def check_enabled 74 def check_enabled
61 User.current = nil 75 User.current = nil
62 unless Setting.sys_api_enabled? && params[:key].to_s == Setting.sys_api_key 76 unless Setting.sys_api_enabled? && params[:key].to_s == Setting.sys_api_key