summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-09-06 04:24:31 +0200
committerNick Thomas <nick@gitlab.com>2017-09-28 13:20:11 +0100
commit38607b48b689b39721ff0cf7355ba2a176f4bf5e (patch)
tree1a20b89406be995c97353fa4bd0caca9bb3aa907 /lib
parente0e49f2f7120fee6ee34236ed6463e4c130f2ad1 (diff)
downloadgitlab-ce-38607b48b689b39721ff0cf7355ba2a176f4bf5e.tar.gz
[Backported from EE] Readonly flag for Projects
This is used in EE for the storage migration, and we want to use this in CE as well to be able to migrate projects to hashed_storage.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git_access.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 62d1ecae676..db67ede9d9e 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -16,7 +16,8 @@ module Gitlab
account_blocked: 'Your account has been blocked.',
command_not_allowed: "The command you're trying to execute is not allowed.",
upload_pack_disabled_over_http: 'Pulling over HTTP is not allowed.',
- receive_pack_disabled_over_http: 'Pushing over HTTP is not allowed.'
+ receive_pack_disabled_over_http: 'Pushing over HTTP is not allowed.',
+ readonly: 'The repository is temporarily read-only. Please try again later.'
}.freeze
DOWNLOAD_COMMANDS = %w{ git-upload-pack git-upload-archive }.freeze
@@ -159,6 +160,10 @@ module Gitlab
end
def check_push_access!(changes)
+ if project.repository_read_only?
+ raise UnauthorizedError, ERROR_MESSAGES[:readonly]
+ end
+
if deploy_key
check_deploy_key_push_access!
elsif user