diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-07-13 21:57:30 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-07-13 21:57:30 +0300 |
commit | 530f5158e297f3cde27f3566cfe13bad74ba3b50 (patch) | |
tree | 270507d396bacdae8a4aa3489edfff0f47b718ca /lib/gitlab/user_access.rb | |
parent | 9b0ef1559f78e58b398e428763ff97dfdc53e186 (diff) |
Revert "Merge branch '18193-developers-can-merge' into 'master'
"
This reverts commit 9ca633eb4c62231e4ddff5466c723cf8e2bdb25d, reversing
changes made to fb229bbf7970ba908962b837b270adf56f14098f.
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r-- | lib/gitlab/user_access.rb | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index c0f85e9b3a8..d1b42c1f9b9 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -1,23 +1,7 @@ module Gitlab - class UserAccess - attr_reader :user, :project - - def initialize(user, project: nil) - @user = user - @project = project - end - - def can_do_action?(action) - @permission_cache ||= {} - @permission_cache[action] ||= user.can?(action, project) - end - - def cannot_do_action?(action) - !can_do_action?(action) - end - - def allowed? - return false if user.blank? || user.blocked? + module UserAccess + def self.allowed?(user) + return false if user.blocked? if user.requires_ldap_check? && user.try_obtain_ldap_lease return false unless Gitlab::LDAP::Access.allowed?(user) @@ -25,31 +9,5 @@ module Gitlab true end - - def can_push_to_branch?(ref) - return false unless user - - if project.protected_branch?(ref) && !project.developers_can_push_to_protected_branch?(ref) - user.can?(:push_code_to_protected_branches, project) - else - user.can?(:push_code, project) - end - end - - def can_merge_to_branch?(ref) - return false unless user - - if project.protected_branch?(ref) && !project.developers_can_merge_to_protected_branch?(ref) - user.can?(:push_code_to_protected_branches, project) - else - user.can?(:push_code, project) - end - end - - def can_read_project? - return false unless user - - user.can?(:read_project, project) - end end end |