Support Git access for group wikis
What does this MR do?
Part of #207869 (closed), extracted from !42863 (closed).
This adds all the necessary routes and other behaviour to enable local Git access to group wiki repositories.
To handle lookups of the wiki container in Gitlab::RepoPath
, we
introduce a Routable.find_by_full_path
helper to find routable objects
without having to know their class.
Database changes
-
CaseSensitivity
: A small tweak to allow passing anArel::Attribute
as a column, instead of just symbols. -
Route
: Added missinginverse_of: route
, because it was causing redundant queries in some cases. -
Routable.find_by_full_path
: This was refactored to use theCaseSensitivity
concern, and be callable directly on the module (when you don't care if the routable is aProject
orGroup
). The existing queries are still the same, although formatted slightly differently.-
Example SQL for
Project.find_by_full_path('foo/bar', follow_redirects: true)
: -
Example SQL for
Routable.find_by_full_path('foo/bar', follow_redirects: true)
:SELECT "routes".* FROM "routes" WHERE "routes"."path" = 'foo/bar' LIMIT 1; SELECT "routes".* FROM "routes" WHERE (LOWER("routes"."path") = LOWER('foo/bar')) ORDER BY "routes"."id" ASC LIMIT 1; SELECT "redirect_routes".* FROM "redirect_routes" WHERE (LOWER("redirect_routes"."path") = LOWER('foo/bar')) LIMIT 1;
- This is the new code path when
Routable.find_by_full_path
is called directly, and we useRoute
/RedirectRoute
rather than the scoped join models. - These separate queries actually seem to perform much better than the combined join queries (a quick benchmark suggets it's almost twice as fast!), so it might be worth reusing this for other code paths in the future.
- Created follow-up issue for this now at #292252 (closed).
- This is the new code path when
-
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team