diff options
author | Toon Claes <toon@iotcl.com> | 2017-09-19 10:44:58 +0300 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2017-10-06 23:37:40 +0300 |
commit | d13669716ab0c31ce9039ae9f7f073e33a4dc40f (patch) | |
tree | 001bb2e6aa76ea7531c93e469c396f7fdcc408a7 /lib/gitlab/git_access_wiki.rb | |
parent | 2cf5dca8f80cdefeb8932bf80417f52f289668c8 (diff) |
Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.
Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.
Closes gitlab-org/gitlab-ce#37534.
Diffstat (limited to 'lib/gitlab/git_access_wiki.rb')
-rw-r--r-- | lib/gitlab/git_access_wiki.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/git_access_wiki.rb b/lib/gitlab/git_access_wiki.rb index 1fe5155c093..98f1f45b338 100644 --- a/lib/gitlab/git_access_wiki.rb +++ b/lib/gitlab/git_access_wiki.rb @@ -1,6 +1,7 @@ module Gitlab class GitAccessWiki < GitAccess ERROR_MESSAGES = { + read_only: "You can't push code to a read-only GitLab instance.", write_to_wiki: "You are not allowed to write to this project's wiki." }.freeze @@ -17,6 +18,10 @@ module Gitlab raise UnauthorizedError, ERROR_MESSAGES[:write_to_wiki] end + if Gitlab::Database.read_only? + raise UnauthorizedError, ERROR_MESSAGES[:read_only] + end + true end end |