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