Fixed #8613 - Added deleted_at to user API response, added all=true to include deleted and not-deleted in one call

This commit is contained in:
snipe 2020-10-26 14:58:45 -07:00
parent b9330cf6b1
commit f42bd3a144
2 changed files with 3 additions and 1 deletions

View file

@ -68,6 +68,8 @@ class UsersController extends Controller
if (($request->filled('deleted')) && ($request->input('deleted')=='true')) {
$users = $users->onlyTrashed();
} elseif (($request->filled('all')) && ($request->input('deleted')=='true')) {
$users = $users->withTrashed();
}
if ($request->filled('company_id')) {

View file

@ -54,7 +54,6 @@ class UsersTransformer
'activated' => ($user->activated =='1') ? true : false,
'two_factor_activated' => ($user->two_factor_active()) ? true : false,
'two_factor_enrolled' => ($user->two_factor_active_and_enrolled()) ? true : false,
'assets_count' => (int) $user->assets_count,
'licenses_count' => (int) $user->licenses_count,
'accessories_count' => (int) $user->accessories_count,
@ -63,6 +62,7 @@ class UsersTransformer
'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'),
'last_login' => Helper::getFormattedDateObject($user->last_login, 'datetime'),
'deleted_at' => ($user->deleted_at) ? Helper::getFormattedDateObject($user->deleted_at, 'datetime') : null,
];
$permissions_array['available_actions'] = [