mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Changes for mobile app
This commit is contained in:
parent
87ad60b71f
commit
76d3d09e7d
@ -467,6 +467,21 @@ class User extends Authenticatable
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function permissionsMap()
|
||||
{
|
||||
$data = [];
|
||||
$permissions = json_decode($this->permissions);
|
||||
|
||||
if (! $permissions) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$keys = array_values((array) $permissions);
|
||||
$values = array_fill(0, count($keys), true);
|
||||
|
||||
return array_combine($keys, $values);
|
||||
}
|
||||
}
|
||||
|
||||
User::created(function ($user)
|
||||
|
@ -146,6 +146,7 @@ class UserAccountTransformer extends EntityTransformer
|
||||
|
||||
return [
|
||||
'account_key' => $account->account_key,
|
||||
'user_id' => (int) ($user->public_id + 1),
|
||||
'name' => $account->present()->name ?: '',
|
||||
'token' => $account->getToken($user->id, $this->tokenName),
|
||||
'default_url' => SITE_URL,
|
||||
|
@ -51,7 +51,7 @@ class UserTransformer extends EntityTransformer
|
||||
'notify_paid' => (bool) $user->notify_paid,
|
||||
'notify_approved' => (bool) $user->notify_approved,
|
||||
'is_admin' => (bool) $user->is_admin,
|
||||
'permissions' => (int) $user->getOriginal('permissions'),
|
||||
'permissions' => $user->permissionsMap(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user