mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Basic check for user's administration ID
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Transformers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
|
||||
@@ -40,20 +41,22 @@ class UserTransformer extends AbstractTransformer
|
||||
* @param User $user
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function transform(User $user): array
|
||||
{
|
||||
$this->repository = $this->repository ?? app(UserRepositoryInterface::class);
|
||||
|
||||
return [
|
||||
'id' => (int)$user->id,
|
||||
'created_at' => $user->created_at->toAtomString(),
|
||||
'updated_at' => $user->updated_at->toAtomString(),
|
||||
'email' => $user->email,
|
||||
'blocked' => 1 === (int)$user->blocked,
|
||||
'blocked_code' => '' === $user->blocked_code ? null : $user->blocked_code,
|
||||
'role' => $this->repository->getRoleByUser($user),
|
||||
'links' => [
|
||||
'id' => (int)$user->id,
|
||||
'administration_id' => (string)$user->getAdministrationId(),
|
||||
'created_at' => $user->created_at->toAtomString(),
|
||||
'updated_at' => $user->updated_at->toAtomString(),
|
||||
'email' => $user->email,
|
||||
'blocked' => 1 === (int)$user->blocked,
|
||||
'blocked_code' => '' === $user->blocked_code ? null : $user->blocked_code,
|
||||
'role' => $this->repository->getRoleByUser($user),
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/users/'.$user->id,
|
||||
|
Reference in New Issue
Block a user