summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-02-22 21:15:40 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-02-22 21:15:40 -0500
commit67948368aec144ff7e9997ce184cb4d111622f08 (patch)
treec94e382fb1aca074b6ce503255564828cb387e36 /app/controllers/application_controller.rb
parent608012629cc90337aba6c5bd4b2b73b530091fb0 (diff)
parent7c8099853621cc2a244bf6e0fd37a8b503d1ec5e (diff)
downloadgitlab-ce-sidebar-sizing-higher-viewport.tar.gz
Merge branch 'master' into sidebar-sizing-higher-viewportsidebar-sizing-higher-viewport
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 2c329b60a19..fb74919ea23 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base
helper_method :abilities, :can?, :current_application_settings
helper_method :import_sources_enabled?, :github_import_enabled?, :github_import_configured?, :gitlab_import_enabled?, :gitlab_import_configured?, :bitbucket_import_enabled?, :bitbucket_import_configured?, :gitorious_import_enabled?, :google_code_import_enabled?, :fogbugz_import_enabled?, :git_import_enabled?
- helper_method :repository
+ helper_method :repository, :can_collaborate_with_project?
rescue_from Encoding::CompatibilityError do |exception|
log_exception(exception)
@@ -410,6 +410,13 @@ class ApplicationController < ActionController::Base
current_user.nil? && root_path == request.path
end
+ def can_collaborate_with_project?(project = nil)
+ project ||= @project
+
+ can?(current_user, :push_code, project) ||
+ (current_user && current_user.already_forked?(project))
+ end
+
private
def set_default_sort