summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-19 14:31:34 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-19 14:31:34 +0200
commit11311a95545f967a5736cd16ab5fc37f7e658519 (patch)
tree484912f3b5b690c67080fd0b2d564c3dfb67924d /lib/gitlab_net.rb
parent45444597aef3e434571de2491934ae92357ad231 (diff)
parent80f5af48e2c66c3f61218f9c7e85f74c634ea8df (diff)
downloadgitlab-shell-11311a95545f967a5736cd16ab5fc37f7e658519.tar.gz
Merge branch 'git_hook_messages'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: VERSION
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index e6478ef..1f27398 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -6,7 +6,7 @@ require_relative 'gitlab_config'
require_relative 'gitlab_logger'
class GitlabNet
- def allowed?(cmd, repo, actor, changes)
+ def check_access(cmd, repo, actor, changes)
project_name = repo.gsub("'", "")
project_name = project_name.gsub(/\.git\Z/, "")
project_name = project_name.gsub(/\A\//, "")
@@ -26,7 +26,11 @@ class GitlabNet
url = "#{host}/allowed"
resp = post(url, params)
- !!(resp.code == '200' && resp.body == 'true')
+ if resp.code == '200'
+ GitAccessStatus.create_from_json(resp.body)
+ else
+ GitAccessStatus.new(false, "API is not accesible")
+ end
end
def discover(key)