Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #8076 #7945 and #5558 #8169

Closed
wants to merge 5 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/Console/Commands/LdapSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use App\Models\Ldap;
use App\Models\User;
use App\Models\Location;
use App\Helpers\Helper;
use Config;
use Input;
use Log;

class LdapSync extends Command
Expand Down Expand Up @@ -51,7 +54,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, Input::old('permissions', array()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be using the old() helper here, instead of the Input:: facade.

Also where is this old data coming from? This is a console command, so there isn't any request data being passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have literally no knowledge of PHP, although i still understand what is happening in the code and what you mean. I just had this problem and i tried to fix it by looking up, how a user was normally created and from there it was just copy-paste with some testing until i found this to be working. But your totally right, that the old input is not needed. I even think, that the "use Input;" line is unnecessary then aswell.


try {
$ldapconn = Ldap::connectToLdap();
Ldap::bindAdminToLdap($ldapconn);
Expand Down Expand Up @@ -177,6 +183,7 @@ public function handle()
$user->password = $pass;
$user->activated = 0;
$item["createorupdate"] = 'created';
$user->permissions = json_encode($permissions_array);
}

$user->first_name = $item["firstname"];
Expand Down