From b27aeb19522dd3a7cee59ce08d3c8202425bdb4f Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 2 Dec 2020 11:01:05 -0800 Subject: [PATCH] Added LDAP flag in users API for #8741 --- app/Http/Controllers/Api/UsersController.php | 3 ++- app/Http/Transformers/UsersTransformer.php | 1 + app/Presenters/UserPresenter.php | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 6b5874df9b..efa4154e59 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -60,6 +60,7 @@ class UsersController extends Controller 'users.updated_at', 'users.username', 'users.zip', + 'users.ldap_import', ])->with('manager', 'groups', 'userloc', 'company', 'department','assets','licenses','accessories','consumables') ->withCount('assets as assets_count','licenses as licenses_count','accessories as accessories_count','consumables as consumables_count'); @@ -131,7 +132,7 @@ class UsersController extends Controller 'assets','accessories', 'consumables','licenses','groups','activated','created_at', 'two_factor_enrolled','two_factor_optin','last_login', 'assets_count', 'licenses_count', 'consumables_count', 'accessories_count', 'phone', 'address', 'city', 'state', - 'country', 'zip', 'id' + 'country', 'zip', 'id', 'ldap_import' ]; $sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name'; diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php index 9a8b0a098f..2c01582ddd 100644 --- a/app/Http/Transformers/UsersTransformer.php +++ b/app/Http/Transformers/UsersTransformer.php @@ -52,6 +52,7 @@ class UsersTransformer 'notes'=> e($user->notes), 'permissions' => $user->decodePermissions(), 'activated' => ($user->activated =='1') ? true : false, + 'ldap_import' => ($user->ldap_import =='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, diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 3ab4a80aa6..77d24265fe 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -225,6 +225,15 @@ class UserPresenter extends Presenter "visible" => true, 'formatter' => 'groupsFormatter' ], + [ + "field" => "ldap_import", + "searchable" => false, + "sortable" => true, + "switchable" => true, + "title" => trans('admin/settings/general.ldap_enabled'), + "visible" => false, + 'formatter' => 'trueFalseFormatter' + ], [ "field" => "two_factor_enrolled", "searchable" => false,