mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Clean up code.
This commit is contained in:
@@ -40,16 +40,6 @@ trait UserGroupTrait
|
||||
protected ?User $user = null;
|
||||
protected ?UserGroup $userGroup = null;
|
||||
|
||||
public function getUserGroup(): ?UserGroup
|
||||
{
|
||||
return $this->userGroup;
|
||||
}
|
||||
|
||||
public function getUser(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function checkUserGroupAccess(UserRoleEnum $role): bool
|
||||
{
|
||||
$result = $this->user->hasRoleInGroupOrOwner($this->userGroup, $role);
|
||||
@@ -63,15 +53,9 @@ trait UserGroupTrait
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO This method does not check if the user has access to this particular user group.
|
||||
*/
|
||||
public function setUserGroup(UserGroup $userGroup): void
|
||||
public function getUser(): ?User
|
||||
{
|
||||
if (null === $this->user) {
|
||||
Log::warning(sprintf('User is not set in repository %s', static::class));
|
||||
}
|
||||
$this->userGroup = $userGroup;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,6 +76,22 @@ trait UserGroupTrait
|
||||
throw new FireflyException(sprintf('Object is of class %s, not User.', $user::class));
|
||||
}
|
||||
|
||||
public function getUserGroup(): ?UserGroup
|
||||
{
|
||||
return $this->userGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO This method does not check if the user has access to this particular user group.
|
||||
*/
|
||||
public function setUserGroup(UserGroup $userGroup): void
|
||||
{
|
||||
if (null === $this->user) {
|
||||
Log::warning(sprintf('User is not set in repository %s', static::class));
|
||||
}
|
||||
$this->userGroup = $userGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user