summaryrefslogtreecommitdiff
path: root/lib/constraints/group_url_constrainer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/constraints/group_url_constrainer.rb')
-rw-r--r--lib/constraints/group_url_constrainer.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/constraints/group_url_constrainer.rb b/lib/constraints/group_url_constrainer.rb
index ca39b1961ae..2bf973a73da 100644
--- a/lib/constraints/group_url_constrainer.rb
+++ b/lib/constraints/group_url_constrainer.rb
@@ -1,7 +1,15 @@
-require 'constraints/namespace_url_constrainer'
+require_relative 'constrainer_helper'
-class GroupUrlConstrainer < NamespaceUrlConstrainer
- def find_resource(id)
- Group.find_by_path(id)
+class GroupUrlConstrainer
+ include ConstrainerHelper
+
+ def matches?(request)
+ id = extract_resource_path(request.path)
+
+ if id =~ Gitlab::Regex.namespace_regex
+ !!Group.find_by_path(id)
+ else
+ false
+ end
end
end