You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see in the documentation how to read from LDIF files with Net::LDAP::Dataset.read_ldif(File.open(file_path)) and how to save entries to LDIF files with File.write file_path, entry.to_ldif.
However, I do not see a clear way of processing adds, deletes, and modifications from LDIF files. Reading from an LDIF file shows :changetype=>["add"] set as if it were an attribute.
Right now I have thrown together something like this.
ldif_mods=Net::LDAP::Dataset.read_ldif(File.open(file_path))Net::LDAP.open(CONFIG)do |ldap|
ldif_mods.eachdo |dn,attrs|
caseattrs[:changetype].firstwhen'add'ldap.adddn: dn,attributes: attrs.reject{ |k,_v| k == :changetype}when'delete'ldap.deletednwhen'modify'# More logic to process attribute modificationsendresult=ldap.get_operation_resultputsresultunlessresult.code.zero?endend
I feel like there should be a better way, similar to how LDIFReader provides #processChange on LDIFChangeRecord.
I see in the documentation how to read from LDIF files with
Net::LDAP::Dataset.read_ldif(File.open(file_path))
and how to save entries to LDIF files withFile.write file_path, entry.to_ldif
.However, I do not see a clear way of processing adds, deletes, and modifications from LDIF files. Reading from an LDIF file shows
:changetype=>["add"]
set as if it were an attribute.Right now I have thrown together something like this.
I feel like there should be a better way, similar to how
LDIFReader
provides#processChange
onLDIFChangeRecord
.The text was updated successfully, but these errors were encountered: