Guest User

Untitled

a guest
Apr 25th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. def sync_ldap_attrs
  2. ldap_attrs = LDAP_MAPPING.inject({}) do |attrs, (key, value)|
  3. attrs[key] = self.send(value)
  4. attrs
  5. end
  6.  
  7. ldap_attrs[:comment] = [self.comment, self.notes].compact.join("\n")
  8. ldap_attrs[:contact_type] = contact_type.name
  9.  
  10. ldap_record.update(ldap_attrs)
  11. if ldap_record.changed?
  12. raise ActiveRecord::Rollback unless ldap_record.save
  13. end
  14. end
  15.  
  16. def ldap_record
  17. @ldap_record ||= (new_record? ? TransisDS::Person.new : TransisDS::Person.fetch_by_uid(self.ldap_uid))
  18. end
Add Comment
Please, Sign In to add comment