Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-05-15 12:17:13 +0400
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-05-15 12:22:59 +0400
commit34fd557055e027b6423241e73b7cf26c741c0b6b (patch)
tree83c1a13a0aa58ca854b52cece504707b4006f432 /lib/gitlab
parent6d45909f03f6cc32f72135ce7ca7b4fd62132c15 (diff)
Move user access check to Gitlab::UserAccess
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/git_access.rb13
-rw-r--r--lib/gitlab/user_access.rb18
2 files changed, 19 insertions, 12 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index f3e781ac4e9..4f49ca4189e 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -61,18 +61,7 @@ module Gitlab
private
def user_allowed?(user)
- return false if user.blocked?
-
- if Gitlab.config.ldap.enabled
- if user.ldap_user?
- # Check if LDAP user exists and match LDAP user_filter
- Gitlab::LDAP::Access.open do |adapter|
- return false unless adapter.allowed?(user)
- end
- end
- end
-
- true
+ Gitlab::UserAccess.allowed?(user)
end
end
end
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
new file mode 100644
index 00000000000..16df21b49ba
--- /dev/null
+++ b/lib/gitlab/user_access.rb
@@ -0,0 +1,18 @@
+module Gitlab
+ module UserAccess
+ def self.allowed?(user)
+ return false if user.blocked?
+
+ if Gitlab.config.ldap.enabled
+ if user.ldap_user?
+ # Check if LDAP user exists and match LDAP user_filter
+ Gitlab::LDAP::Access.open do |adapter|
+ return false unless adapter.allowed?(user)
+ end
+ end
+ end
+
+ true
+ end
+ end
+end