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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 21:06:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 21:06:53 +0300
commit143f196f8b3c40ceb7e9335a8dcc712b079519b9 (patch)
tree909df13e1f99b456287934741ba466b506e01129 /lib/gitlab/gitaly_client
parent575ccb036ea14c6a899482a83bd985ffbc992077 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r--lib/gitlab/gitaly_client/namespace_service.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/gitaly_client/namespace_service.rb b/lib/gitlab/gitaly_client/namespace_service.rb
index f95833eed01..dbcebec3aa2 100644
--- a/lib/gitlab/gitaly_client/namespace_service.rb
+++ b/lib/gitlab/gitaly_client/namespace_service.rb
@@ -3,7 +3,22 @@
module Gitlab
module GitalyClient
class NamespaceService
+ extend Gitlab::TemporarilyAllow
+
+ NamespaceServiceAccessError = Class.new(StandardError)
+ ALLOW_KEY = :allow_namespace
+
+ def self.allow
+ temporarily_allow(ALLOW_KEY) { yield }
+ end
+
+ def self.denied?
+ !temporarily_allowed?(ALLOW_KEY)
+ end
+
def initialize(storage)
+ raise NamespaceServiceAccessError if self.class.denied?
+
@storage = storage
end