mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-16 18:25:00 -06:00
This commit is contained in:
parent
e003dcd596
commit
f66dd259f0
@ -126,15 +126,13 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getBudgets(): Collection
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repos */
|
||||
$repos = app(BudgetRepositoryInterface::class);
|
||||
throw new FireflyException('uses old administration ID check, needs to be updated.F');
|
||||
$repos->setAdministrationId($this->getAdministrationId());
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$repository->setUserGroup($this->getUserGroup());
|
||||
|
||||
return $repos->getActiveBudgets();
|
||||
return $repository->getActiveBudgets();
|
||||
}
|
||||
}
|
||||
|
@ -40,16 +40,11 @@ trait UserGroupTrait
|
||||
protected UserGroup $userGroup;
|
||||
|
||||
/**
|
||||
* @param Authenticatable|User|null $user
|
||||
*
|
||||
* @return void
|
||||
* @return UserGroup
|
||||
*/
|
||||
public function setUser(Authenticatable | User | null $user): void
|
||||
public function getUserGroup(): UserGroup
|
||||
{
|
||||
if (null !== $user) {
|
||||
$this->user = $user;
|
||||
$this->userGroup = $user->userGroup;
|
||||
}
|
||||
return $this->userGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,6 +59,19 @@ trait UserGroupTrait
|
||||
$this->userGroup = $userGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Authenticatable|User|null $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUser(Authenticatable | User | null $user): void
|
||||
{
|
||||
if (null !== $user) {
|
||||
$this->user = $user;
|
||||
$this->userGroup = $user->userGroup;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $userGroupId
|
||||
*
|
||||
@ -77,9 +85,13 @@ trait UserGroupTrait
|
||||
if (0 === $memberships) {
|
||||
throw new FireflyException(sprintf('User #%d has no access to administration #%d', $this->user->id, $userGroupId));
|
||||
}
|
||||
$this->userGroup = UserGroup::find($userGroupId);
|
||||
if (null === $this->userGroup) {
|
||||
throw new FireflyException(sprintf('Unfound administration for user #%d', $this->user->id));
|
||||
/** @var UserGroup|null $userGroup */
|
||||
$userGroup = UserGroup::find($userGroupId);
|
||||
if (null === $userGroup) {
|
||||
throw new FireflyException(sprintf('Cannot find administration for user #%d', $this->user->id));
|
||||
}
|
||||
$this->userGroup = $userGroup;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user