Support defaults for general preferences in All-Users

The All-Users repository contains a refs/users/default branch for
configuring defaults that apply to all users. It already has a
preferences.config file for configuring default preferences that
overwrite the defaults that are hard-coded in Gerrit. However so far
only defaults for diff preferences and my menu entries are supported.
With this change defaults for all general preferences are supported.

When comparing preferences in the test we exclude the my menus because
GeneralPreferencesInfo.defaults() doesn't contain the my menu
defaults, but they are computed on the fly.

General preferences are stored in the accounts, this is why we need to
flush the account cache when the defaults for the general preferences
are changed.

Change-Id: Icdea2bf81ce1a49aba095735099b9bfcafad5a73
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-06-03 17:08:34 +02:00
parent 5a42f00e40
commit e9f5da3e63
12 changed files with 438 additions and 41 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.extensions.api.config;
import com.google.gerrit.extensions.client.DiffPreferencesInfo;
import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
@@ -24,6 +25,9 @@ public interface Server {
*/
String getVersion() throws RestApiException;
GeneralPreferencesInfo getDefaultPreferences() throws RestApiException;
GeneralPreferencesInfo setDefaultPreferences(GeneralPreferencesInfo in)
throws RestApiException;
DiffPreferencesInfo getDefaultDiffPreferences() throws RestApiException;
DiffPreferencesInfo setDefaultDiffPreferences(DiffPreferencesInfo in)
throws RestApiException;
@@ -38,6 +42,18 @@ public interface Server {
throw new NotImplementedException();
}
@Override
public GeneralPreferencesInfo getDefaultPreferences()
throws RestApiException {
throw new NotImplementedException();
}
@Override
public GeneralPreferencesInfo setDefaultPreferences(
GeneralPreferencesInfo in) throws RestApiException {
throw new NotImplementedException();
}
@Override
public DiffPreferencesInfo getDefaultDiffPreferences()
throws RestApiException {