Fix user management for groups.

This commit is contained in:
James Cole
2020-06-20 10:22:07 +02:00
parent 5b29e78c4b
commit c036c5a2bc
5 changed files with 64 additions and 10 deletions

View File

@@ -64,6 +64,7 @@ use FireflyIII\Support\Preferences;
use FireflyIII\Support\Steam;
use FireflyIII\Support\Telemetry;
use FireflyIII\Validation\FireflyValidator;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Validator;
@@ -174,9 +175,23 @@ class FireflyServiceProvider extends ServiceProvider
// other generators
$this->app->bind(UserRepositoryInterface::class, UserRepository::class);
$this->app->bind(TransactionTypeRepositoryInterface::class, TransactionTypeRepository::class);
$this->app->bind(ObjectGroupRepositoryInterface::class,ObjectGroupRepository::class);
$this->app->bind(AttachmentHelperInterface::class, AttachmentHelper::class);
$this->app->bind(
ObjectGroupRepositoryInterface::class,
static function (Application $app) {
/** @var ObjectGroupRepository $repository */
$repository = app(ObjectGroupRepository::class);
if ($app->auth->check()) {
$repository->setUser(auth()->user());
}
return $repository;
}
);
// more generators:
$this->app->bind(PopupReportInterface::class, PopupReport::class);
$this->app->bind(HelpInterface::class, Help::class);
@@ -185,7 +200,7 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind(UpdateRequestInterface::class, UpdateRequest::class);
$this->app->bind(TelemetryRepositoryInterface::class, TelemetryRepository::class);
$class = (string)config(sprintf('firefly.cer_providers.%s', (string)config('firefly.cer_provider')));
$class = (string) config(sprintf('firefly.cer_providers.%s', (string) config('firefly.cer_provider')));
if ('' === $class) {
throw new FireflyException('Invalid currency exchange rate provider. Cannot continue.');
}