22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/ad-framework/patterns/searchable.rb', line 22
def reload
args = {
:where => { :dn__eq => (self.fields[:distinguishedname] || self.fields[:dn]) },
:limit => 1
}
search_args = self.class.build_ad_search_args(args)
ldap_entry = self.connection.search(search_args).first
if ldap_entry
AD::Framework::Utilities::EntryBuilder.new(ldap_entry, { :reload => self })
else
dn = args[:where][:dn__eq]
raise(*[
AD::Framework::EntryNotFound,
"An entry could not be found with dn #{dn.inspect} (#{self.class})"
])
end
self
end
|