Allow admins to configure URL aliases

This allows to map plugin screens into the Gerrit URL namespace, e.g.:

  [urlAlias "MyPluginScreen"]
    match = /myscreen/(.*)
    token = /x/myplugin/myscreen/$1

This can also be used to replace Gerrit screens with plugin screens,
e.g. to replace change screen:

  [urlAlias "MyChangeScreen"]
    match = /c/(.*)
    token = /x/myplugin/c/$1

Defining URL aliases is similar to defining comment links. This is why
a similar representation in the gerrit.config was chosen.

Change-Id: Ie4a3b69703629051f7627eeb0c479dfc964f27ae
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-07-16 12:38:52 +02:00
parent 8586292fcf
commit fa0d494d11
8 changed files with 140 additions and 1 deletions

View File

@@ -3767,6 +3767,46 @@ on the server. One or more groups can be set.
If no groups are added, any user will be allowed to execute
'upload-pack' on the server.
[[urlAlias]]
=== Section urlAlias
URL aliases define regular expressions for URL tokens that are mapped
to target URL tokens.
Each URL alias must be specified in its own subsection. The subsection
name should be a descriptive name. It must be unique, but is not
interpreted in any way.
The URL aliases are applied in no particular order. The first matching
URL alias is used and further matches are ignored.
URL aliases can be used to map plugin screens into the Gerrit URL
namespace, or to replace Gerrit screens by plugin screens.
Example:
----
[urlAlias "MyPluginScreen"]
match = /myscreen/(.*)
token = /x/myplugin/myscreen/$1
[urlAlias "MyChangeScreen"]
match = /c/(.*)
token = /x/myplugin/c/$1
----
[[urlAlias.match]]urlAlias.match::
+
A regular expression for a URL token.
+
The matched URL token is replaced by `urlAlias.token`.
[[urlAlias.token]]urlAlias.token::
+
The target URL token.
+
It can contain placeholders for the groups matched by the
`urlAlias.match` regular expression: `$1` for the first matched group,
`$2` for the second matched group, etc.
[[submodule]]
=== Section submodule