summaryrefslogtreecommitdiff
path: root/lib/gitlab_access_status.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-08-14 00:22:46 +0100
committerNick Thomas <nick@gitlab.com>2018-08-14 00:22:46 +0100
commitc8bf2e7d47c3b8f34cb79847edcd5dd50b8f280e (patch)
treecc22dc6c91f58ccaadd97fdd816159de6ec8a135 /lib/gitlab_access_status.rb
parent764f6f47fa6a8698ae033532ae49875a87030518 (diff)
downloadgitlab-shell-c8bf2e7d47c3b8f34cb79847edcd5dd50b8f280e.tar.gz
Revert "Merge branch 'ash.mckenzie/srp-refactor' into 'master'"
This reverts commit 3aaf4751e09262c53544a1987f59b1308af9b6c1, reversing changes made to c6577e0d75f51b017f2f332838b97c3ca5b497c0.
Diffstat (limited to 'lib/gitlab_access_status.rb')
-rw-r--r--lib/gitlab_access_status.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb
new file mode 100644
index 0000000..c639462
--- /dev/null
+++ b/lib/gitlab_access_status.rb
@@ -0,0 +1,32 @@
+require 'json'
+
+class GitAccessStatus
+ attr_reader :message, :gl_repository, :gl_id, :gl_username, :repository_path, :gitaly, :git_protocol
+
+ def initialize(status, message, gl_repository:, gl_id:, gl_username:, repository_path:, gitaly:, git_protocol:)
+ @status = status
+ @message = message
+ @gl_repository = gl_repository
+ @gl_id = gl_id
+ @gl_username = gl_username
+ @repository_path = repository_path
+ @gitaly = gitaly
+ @git_protocol = git_protocol
+ end
+
+ def self.create_from_json(json)
+ values = JSON.parse(json)
+ new(values["status"],
+ values["message"],
+ gl_repository: values["gl_repository"],
+ gl_id: values["gl_id"],
+ gl_username: values["gl_username"],
+ repository_path: values["repository_path"],
+ gitaly: values["gitaly"],
+ git_protocol: values["git_protocol"])
+ end
+
+ def allowed?
+ @status
+ end
+end