Search in sources :

Example 1 with CheckAccountsResultInfo

use of com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckAccountsResultInfo in project gerrit by GerritCodeReview.

the class CheckConsistency method apply.

@Override
public Response<ConsistencyCheckInfo> apply(ConfigResource resource, ConsistencyCheckInput input) throws RestApiException, IOException, PermissionBackendException, ConfigInvalidException {
    permissionBackend.currentUser().check(GlobalPermission.ACCESS_DATABASE);
    if (input == null || (input.checkAccounts == null && input.checkAccountExternalIds == null && input.checkGroups == null)) {
        throw new BadRequestException("input required");
    }
    ConsistencyCheckInfo consistencyCheckInfo = new ConsistencyCheckInfo();
    if (input.checkAccounts != null) {
        consistencyCheckInfo.checkAccountsResult = new CheckAccountsResultInfo(accountsConsistencyChecker.check());
    }
    if (input.checkAccountExternalIds != null) {
        consistencyCheckInfo.checkAccountExternalIdsResult = new CheckAccountExternalIdsResultInfo(externalIdsConsistencyChecker.check());
    }
    if (input.checkGroups != null) {
        consistencyCheckInfo.checkGroupsResult = new CheckGroupsResultInfo(groupsConsistencyChecker.check());
    }
    return Response.ok(consistencyCheckInfo);
}
Also used : CheckAccountsResultInfo(com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckAccountsResultInfo) ConsistencyCheckInfo(com.google.gerrit.extensions.api.config.ConsistencyCheckInfo) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) CheckGroupsResultInfo(com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckGroupsResultInfo) CheckAccountExternalIdsResultInfo(com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckAccountExternalIdsResultInfo)

Aggregations

ConsistencyCheckInfo (com.google.gerrit.extensions.api.config.ConsistencyCheckInfo)1 CheckAccountExternalIdsResultInfo (com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckAccountExternalIdsResultInfo)1 CheckAccountsResultInfo (com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckAccountsResultInfo)1 CheckGroupsResultInfo (com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.CheckGroupsResultInfo)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1