snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

LDAP Sync changes location but doesn't save

Open devvonmonahan opened this issue 4 years ago • 3 comments

Debug mode

Describe the bug

If a user changes OU (with OU Location Sync being set up), after doing an LDAP sync, the user will still appear to be in the old OU. If you go into SnipeIT and click "edit" on their profile, the new locations will be set. If you cancel and go back to searching the locations, they will still be under the old location.

If you go back to editing their profile, without changing anything and click "save", they will now be in the correct location

Reproduction steps

  1. Set up locations with OU syncing.
  2. Go to Active Directory and change a users OU
  3. Go to SnipeIT and do an LDAP sync
  4. Check the user in question and their location
  5. The location and department (both set from LDAP sync) is still set to the old locations
  6. If I click edit, then save without making any changes, the expected changes are now made.

Expected behavior

After step 4 in the reproduction steps, I'd expect to see them in the new OU without any further steps.

Screenshots

No response

Snipe-IT Version

v6.0.4 build 8050

Operating System

Ubuntu

Web Server

Nginx

PHP Version

7.4.3

Operating System

Ubuntu 2204

Browser

Google Chrome

Version

106

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

devvonmonahan avatar Oct 25 '22 22:10 devvonmonahan

yea, we have the same issue. I Posted it a while ago here on Github https://github.com/snipe/snipe-it/issues/10106 The user gets updated, but the assets are staying at the old location. But your solution to edit the user and save it, is WAY smarter than what we did. We checked in and out, every asset to the user.

So i can't help you sadly, but thanks for the help :)

H4usi avatar Feb 02 '23 08:02 H4usi

@Godmartinz Have you managed to figure out the cause for this ticket and #10106 ?

devvonmonahan avatar Feb 03 '23 01:02 devvonmonahan

@H4usi , I've noticed you can fix this with a daily cron job (if you are using linux) by running the following command in your project root: php artisan snipeit:sync-asset-locations --output=all

Keep in mind a few things that I found;

  1. Any asset checked in with a location & without a default location will have their location wiped as a result of the command. I suggest doing a backup, testing the command and looking at the affects with your dataset to fully assess this.
  2. Any asset checked in with a location & default location that is different, the default location will take precedence.
  3. To add to point 2, the default location does not get set upon checking in an asset as per issue #13167

devvonmonahan avatar Jun 14 '23 13:06 devvonmonahan