🤖 Auto commit for release 'develop' on 2025-09-26

This commit is contained in:
JC5
2025-09-26 19:43:39 +02:00
parent 853a99852e
commit d3c557ca22
103 changed files with 1411 additions and 1336 deletions

View File

@@ -61,10 +61,10 @@ trait UserGroupTrait
/**
* @throws FireflyException
*/
public function setUser(Authenticatable | User | null $user): void
public function setUser(Authenticatable|User|null $user): void
{
if ($user instanceof User) {
$this->user = $user;
$this->user = $user;
if (null === $user->userGroup) {
throw new FireflyException(sprintf('User #%d ("%s") has no user group.', $user->id, $user->email));
}
@@ -99,14 +99,15 @@ trait UserGroupTrait
public function setUserGroupById(int $userGroupId): void
{
$memberships = GroupMembership::where('user_id', $this->user->id)
->where('user_group_id', $userGroupId)
->count();
->where('user_group_id', $userGroupId)
->count()
;
if (0 === $memberships) {
throw new FireflyException(sprintf('User #%d has no access to administration #%d', $this->user->id, $userGroupId));
}
/** @var null|UserGroup $userGroup */
$userGroup = UserGroup::find($userGroupId);
$userGroup = UserGroup::find($userGroupId);
if (null === $userGroup) {
throw new FireflyException(sprintf('Cannot find administration for user #%d', $this->user->id));
}