Commit 6a82632b authored by Douwe Maan's avatar Douwe Maan

Apply GroupUrlConstrainer to all routes with group IDs

parent 50891701
...@@ -2,7 +2,8 @@ require 'constraints/group_url_constrainer' ...@@ -2,7 +2,8 @@ require 'constraints/group_url_constrainer'
resources :groups, only: [:index, :new, :create] resources :groups, only: [:index, :new, :create]
scope(path: 'groups/*id', constraints(GroupUrlConstrainer.new) do
scope(path: 'groups/*id',
controller: :groups, controller: :groups,
constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do
get :edit, as: :edit_group get :edit, as: :edit_group
...@@ -12,9 +13,9 @@ scope(path: 'groups/*id', ...@@ -12,9 +13,9 @@ scope(path: 'groups/*id',
get :activity, as: :activity_group get :activity, as: :activity_group
get :subgroups, as: :subgroups_group get :subgroups, as: :subgroups_group
get '/', action: :show, as: :group_canonical get '/', action: :show, as: :group_canonical
end end
scope(path: 'groups/*group_id', scope(path: 'groups/*group_id',
module: :groups, module: :groups,
as: :group, as: :group,
constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do
...@@ -82,7 +83,6 @@ scope(path: 'groups/*group_id', ...@@ -82,7 +83,6 @@ scope(path: 'groups/*group_id',
get :boards, to: redirect('/groups/%{group_id}/-/boards') get :boards, to: redirect('/groups/%{group_id}/-/boards')
end end
constraints(GroupUrlConstrainer.new) do
scope(path: '*id', scope(path: '*id',
as: :group, as: :group,
constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment