Rails and devise ldap user search

In my Rails application, I implemented user login via LDAP. The plan was that the user logs in for the first time and the administrator decides which group the user will belong to. However, the expectation is that the administrator will find the user himself and grant him the appropriate permissions. Now I have no idea how to implement the domain user search. For logging I’m using devise and the devise_ldap_authenticatable gem and it works perfectly. At the moment I have the User model, controller controllers/users/sessions_controller.rb and a page for the administrator where he can assign users to the appropriate group. Any suggestion what do I need to allow administrator to serach for users in domain instead existing ones in database?

The net-ldap gem (already installed in your application via devise_ldap_authenticatable) allows searching LDAP.

Refer to the gem’s documentation for more details: Class: Net::LDAP — Documentation for net-ldap (0.19.0)