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>2020-05-04 09:10:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 09:10:10 +0300
commit2fa68d3a97fd31bf469050e130f0fc95e8944316 (patch)
tree5c00585c55c44917765c152426cb58c803b4f57f /lib/gitlab/git_access_design.rb
parent21be9646a94e2c145897e25d9c521523d55e1614 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/git_access_design.rb')
-rw-r--r--lib/gitlab/git_access_design.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/git_access_design.rb b/lib/gitlab/git_access_design.rb
new file mode 100644
index 00000000000..36604bd0b3b
--- /dev/null
+++ b/lib/gitlab/git_access_design.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Gitlab
+ class GitAccessDesign < GitAccess
+ def check(_cmd, _changes)
+ check_protocol!
+ check_can_create_design!
+
+ success_result
+ end
+
+ private
+
+ def check_protocol!
+ if protocol != 'web'
+ raise ::Gitlab::GitAccess::ForbiddenError, "Designs are only accessible using the web interface"
+ end
+ end
+
+ def check_can_create_design!
+ unless user&.can?(:create_design, project)
+ raise ::Gitlab::GitAccess::ForbiddenError, "You are not allowed to manage designs of this project"
+ end
+ end
+ end
+end
+
+Gitlab::GitAccessDesign.prepend_if_ee('EE::Gitlab::GitAccessDesign')