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

Conditionally update assets when user's location moves via LDAP #16046

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

uberbrady
Copy link
Collaborator

Fixes: [fd-45970]

We added code to change assets' locations if the user's location changes via LDAP. But the way the query was working, it would tweak the 'updated at' attribute on the user whether or not it actually changed the location of the asset in question. This was confusing for one of our customers in how they use the app.

Additionally, if a change was made, there wasn't going to be any log entry in the asset history to explain why it wasn't in the location that it had been before.

This fixes both problems - only making changes to the assets of the user if the user's location has actually changed, and making sure that it's a regular save() so that a log entry with an 'update' will still get created.

I tested this on our test LDAP server, setting the ldap_location attribute to physicaldeliveryofficename, and setting the 'Office' value of one of the users to one of our locations. Then I changed the user's location on my development environment, did a checkout of an asset to that user, then ran an LDAP sync. When I did that, the asset showed an 'update' action of it moving from the old location to the LDAP-based one.

Copy link

what-the-diff bot commented Jan 9, 2025

PR Summary

  • Improved Asset Location Update Logic
    The system now monitors if a user's asset location ID has been altered, enhancing the accuracy of asset tracking.

  • Individual Asset Location Updates
    Rather than updating all assets at once, the new code carefully goes through each asset and updates its location ID separately, potentially reducing errors or oversights in tracking.

  • Potential for Enhanced Documentation of Asset Location Changes
    The team has proposed the idea of adding a note whenever an asset's location changes, showcasing future opportunities for improved traceability and record-keeping.

@snipe snipe merged commit 06ffac9 into snipe:develop Jan 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants