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

User import with LDAP

Open thomsonza opened this issue 12 years ago • 30 comments

When checking assets out to users it would be great if it was possible to get a list of users from LDAP rather than having to add each of them individually.

thomsonza avatar Feb 24 '14 06:02 thomsonza

This is a duplicate of #48, no?

snipe avatar Feb 24 '14 06:02 snipe

I looked at #48 but it's not really the authentication, although the authentication part of it would be great. Not all of our users would have login access to the asset database but we would need to assign a computer to their name. I suppose they could be one and the same and just switch off logins for those users.

thomsonza avatar Feb 24 '14 20:02 thomsonza

I had been sussing out how to handle that as well. Tracmor does this reasonably well, and it's worth considering to actually break it out the way they do, so you have contacts and users as a separate thing. Let me chew on that a little bit. I appreciate your input.

snipe avatar Feb 24 '14 20:02 snipe

We agree splitting system users and Asset assignable "contacts" is probably a better, more sustainable way to go. User would be LDAP authenticated, and Owners/Contacts would could easily be an LDAP sync or CSV import.

technogenus avatar Aug 07 '14 05:08 technogenus

LDAP has always been on the roadmap, but it cannot be a requirement. The point of this project was to offer an IT asset management system to smaller organizations, and some of then won't have LDAP, or if they do, it may be difficult to accomplish integration within the organization.

I've looked at some LDAP packages which seem promising, so I doubt we'd need to reinvent the wheel, but it must remain an optional feature.

snipe avatar Aug 07 '14 08:08 snipe

Totally agree LDAP should always be an alternative auth mechanism. For our specific needs its a must (down the line... eventual... lower priority must), as well as an LDAP import/sync function but recognize we would be the minority case.

better wording: User would be either dbstore Sentry or LDAP authenticated, and Owners/Contacts/People could easily be imported from LDAP, CSV, excel or other means.

technogenus avatar Aug 07 '14 08:08 technogenus

Test server here may work for anyone looking to work on this feature: http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/

snipe avatar Feb 13 '15 19:02 snipe

OK. So I am a little confused here. I have read several requests dealing with LDAP integration for assigning devices to users. Is there a way to do this or not? I see that this case has the ready label. Does that mean that this has been implemented into SNIPE-IT?

csayre avatar Apr 27 '15 20:04 csayre

No, this means it's ready to be worked on

snipe avatar Apr 27 '15 20:04 snipe

Ah ok. I was a little confused. Any Idea of when it will be implemented?

csayre avatar Apr 27 '15 20:04 csayre

Not sure - there aren't a lot of good libraries for LDAp at this point. I know a few people have mentioned they wanted to work on it, but I haven't heard anyone report back on progress, so I would assume it's not been started yet. (I know I haven't been working on it.)

snipe avatar Apr 27 '15 20:04 snipe

The company that I am working for uses ticketos ( I know there were talks of integrating the two projects). Anything more on that? We need a solution that supports ad integration, i just stumbled upon this project today. I hope you guys get ldap or AD integration implemented relatively quickly, I would love to use this at our company, but that is a big selling point for our company.

csayre avatar Apr 27 '15 20:04 csayre

_If this is still of interest, I have created and tested an LDAP sync function. My goal was to create users that would never have access to the system but that use our services... hence I only need to track what they have and potentially communicate with them. _How it works You configure LDAP via an ldap.php file (url, usrename, password, search query, etc...) and then when you hit sync, the application connects to LDAP and fetches the required fields. Users are then created sequentially. For each user, a note is added to indicate that they were created using the LDAP sync script. In addition all accounts are automatically activated and no passwords are emailed. I've been able to import 5,000+ users in one go using it. I'm happy to submit a pull request but will need information on whether or not I need to create a specific branch (or the process defined for snipe-it) _Some screenshots_ Screen 1 ldap-sync Screen 2 ldap-sync-page

aalaily avatar Aug 14 '15 04:08 aalaily

Hi @aalaily - nice work! A few questions:

  • How does it handle existing users?
  • How does it handle deleted users (users no longer in LDAP but still in Snipe-IT, OR users that were imported via LDAP sync and were marked as deleted in Snipe-IT)

snipe avatar Aug 14 '15 23:08 snipe

Hi Snipe,

_How does it handle existing users?_ If the user already exists in the system, the code simply skips over them and displays a message "exists" in the result page (which contains a summary of action for each user) _How does it handle deleted users (users no longer in LDAP but still in Snipe-IT_ Right now the code doesn't cross-check. That is, if the user is not in LDAP but is still in Snipe-IT the user remains untouched. For this specific case, my thought was to mark them as inactive in Snipe-IT. That should be fairly easy to do. _Users that were imported via LDAP sync and were marked as deleted in Snipe-IT_ That's a case I haven't tested yet... however, if the user still exists in the user table the code will simply not touch them.

_Extra functionality - LDAP authentication_ I've now been able to integrate LDAP into the login. If the user has "LDAP" in the "notes" field (as when they are imported by the sync script), the authentication goes against LDAP. This can be enhanced by adding a "authenticate against LDAP" checkbox in the user profile... but right now, it's looking at the "notes" field. Fort this functionality, the hook is added to the AuthController class's postSignin method.

aalaily avatar Aug 15 '15 00:08 aalaily

This sounds great - I'd love a pull request against the develop branch so I can take a look. Thanks!

snipe avatar Aug 15 '15 00:08 snipe

No problem! I will submit a pull request and feedback will be much appreciated.

aalaily avatar Aug 15 '15 01:08 aalaily

OK... the pull request has been submitted.

aalaily avatar Aug 15 '15 01:08 aalaily

@aalaily - for existing users, is it matching off the LDAP username or email address?

hansenc0705 avatar Aug 15 '15 02:08 hansenc0705

@kobie-chasehansen - it's matching on the username

aalaily avatar Aug 15 '15 02:08 aalaily