diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-06 17:02:36 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-11 11:51:15 +0300 |
commit | 12dd2b0cc0cf6dd8dc43ff8b8df8687268ba4af5 (patch) | |
tree | 65dd7c5467b931dc1777214dc1416c78add7891a /app/controllers/projects/application_controller.rb | |
parent | 8ad9c4e873f2185e8bbfa6f363db32dbbba27141 (diff) |
Share collaboration check between view and presenter
Diffstat (limited to 'app/controllers/projects/application_controller.rb')
-rw-r--r-- | app/controllers/projects/application_controller.rb | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 53a0c712e49..032bb2267e7 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -1,5 +1,6 @@ class Projects::ApplicationController < ApplicationController include RoutableActions + include ChecksCollaboration skip_before_action :authenticate_user! before_action :project @@ -31,18 +32,6 @@ class Projects::ApplicationController < ApplicationController @repository ||= project.repository end - def can_collaborate_with_project?(project = nil, ref: nil) - project ||= @project - - can_create_merge_request = - can?(current_user, :create_merge_request_in, project) && - current_user.already_forked?(project) - - can?(current_user, :push_code, project) || - can_create_merge_request || - user_access(project).can_push_to_branch?(ref) - end - def authorize_action!(action) unless can?(current_user, action, project) return access_denied! @@ -95,9 +84,4 @@ class Projects::ApplicationController < ApplicationController def check_issues_available! return render_404 unless @project.feature_available?(:issues, current_user) end - - def user_access(project) - @user_access ||= {} - @user_access[project] ||= Gitlab::UserAccess.new(current_user, project: project) - end end |