-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Note
I posted this in the discord first incase I was setting something wrong, but after some research, I believe this is unintended behaviour.
Hi there!
When Full Multiple Company Support and Location scoping is enabled, when I try to sync new users into Snipe with the LDAP Location setting set, the new users aren't created and gets a failed message Full multiple company support and location scoping is enabled in the Admin Settings, and the selected location and selected company are not compatible.
After posting in the discord, and pointed to the validation code, I found the following lines of code:
if (($location) && ($company_id != $location->company_id)) {
return false;
}This lead me to believe the issue is that when users are initially synced, they aren't getting their company_id set, so this will always fail.
To workaround this, I added the following line to this part of the code:
if($ldap_map["location"] != null){
$user->location_id = $location?->id;
+ $user->company_id = $location?->id;
}This now allows me to sync users that have the correct ldap attribute set in LDAP Location, I'm positive theres a better way to fix this, as I'm very new to programming and have zero experience with php (until now 😋), but it fits for my use case for now until theres a better solution.
Thanks for all of your hard work!