Class: FakeLDAP::Operation
- Inherits:
-
LDAP::Server::Operation
- Object
- LDAP::Server::Operation
- FakeLDAP::Operation
- Defined in:
- lib/fakeldap.rb
Instance Method Summary collapse
-
#initialize(connection, messageID, server) ⇒ Operation
constructor
A new instance of Operation.
- #search(basedn, scope, deref, filter, attrs = nil) ⇒ Object
- #simple_bind(version, dn, password) ⇒ Object
Constructor Details
#initialize(connection, messageID, server) ⇒ Operation
Returns a new instance of Operation.
37 38 39 40 |
# File 'lib/fakeldap.rb', line 37 def initialize(connection, , server) super(connection, ) @server = server end |
Instance Method Details
#search(basedn, scope, deref, filter, attrs = nil) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fakeldap.rb', line 54 def search(basedn, scope, deref, filter, attrs=nil) unless filter.first == :eq raise LDAP::ResultError::UnwillingToPerform, "Only equality matches are supported" end @server.find_users(basedn, filter).each do |dn| send_SearchResultEntry(dn, {}) end end |
#simple_bind(version, dn, password) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fakeldap.rb', line 42 def simple_bind(version, dn, password) unless dn raise LDAP::ResultError::InappropriateAuthentication, "This server does not support anonymous bind" end unless @server.valid_credentials?(dn, password) raise LDAP::ResultError::InvalidCredentials, "Invalid credentials" end end |