diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index a7941050f820..47404c2d080b 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -7,6 +7,8 @@ use App\Models\Ldap; use App\Models\User; use App\Models\Location; +use App\Helpers\Helper; +use Config; use Log; class LdapSync extends Command @@ -51,7 +53,10 @@ public function handle() $ldap_result_active_flag = Setting::getSettings()->ldap_active_flag_field; $ldap_result_emp_num = Setting::getSettings()->ldap_emp_num; $ldap_result_email = Setting::getSettings()->ldap_email; - + + $permissions = config('permissions'); + $permissions_array = Helper::selectedPermissionsArray($permissions); + try { $ldapconn = Ldap::connectToLdap(); Ldap::bindAdminToLdap($ldapconn); @@ -177,6 +182,7 @@ public function handle() $user->password = $pass; $user->activated = 0; $item["createorupdate"] = 'created'; + $user->permissions = json_encode($permissions_array); } $user->first_name = $item["firstname"];