openrecord
Version:
Active record like ORM for nodejs
27 lines (24 loc) • 519 B
JavaScript
exports.definition = {
mixinCallback: function() {
this.rdn_prefix = 'cn'
},
/**
* Set the rdn prefix
*
* @public
* @memberof LDAP.Definition
* @param {string} prefix - The prefix
*
* @return {Definition}
*/
rdnPrefix: function(prefix) {
this.rdn_prefix = prefix
return this
},
dn: function(record) {
if (!record[this.rdn_prefix] && record.dn) return record.dn
return (
this.rdn_prefix + '=' + record[this.rdn_prefix] + ',' + record.parent_dn
)
}
}