Closed GoogleCodeExporter closed 9 years ago
Should we support validate_on_rename?
ActiveLdap::Base#create updates errors because it uses validation mechanism.
(validate_on_create)
Original comment by kou...@gmail.com
on 9 Aug 2009 at 2:48
Maybe yes. In case support validate_on_rename Ruby/LDAP needs to be updated?
Maybe we can use validate_on_update mechanism?
Original comment by Alexey.Chebotar@gmail.com
on 11 Aug 2009 at 7:25
Hi kou, I found temporary solution for this problem :)
I have created global model with method rename_to(new_rdn):
def rename_to(new_rdn)
old_dn = self.dn
old_rdn = self.id
self.id = new_rdn
if self.valid?
self.id = old_rdn
self.dn = old_dn
self.modify_rdn_entry(self.dn, "#{self.dn_attribute}=#{new_rdn}", true, {})
self.id = new_rdn
self.dn = old_dn.gsub(old_rdn, new_rdn)
self.reload
return true
else
return false
end
end
Manipulation with dn needed for me, because of dynamic prefixes of records.
P.S.: Dynamic prefixes meaning: Rails models, includes static prefix
"ou=domains",
but entries written in LDAP has other prefix, some like
"ou=users,dc=test.com,ou=domains". (I was changing dn during validation)
>> user = User.find("admin", :prefix => "ou=users,dc=test.com")
=> #<User objectClass:<User>, must:<uid>, may:<>
>> user.dn
=> "uid=admin,ou=users,dc=test.com,ou=domains,dc=...,dc=com"
>> user.id
=> "admin"
>> user.prefix
=> "ou=domains"
>> user.id = "test"
=> "test"
>> user.dn
=> "uid=test,ou=domains,dc=...,dc=com"
I think dn should be:
"uid=test,ou=users,dc=test.com,ou=domains,dc=...,dc=com"
but I'm not sure if it's will be correct.
Hope this will help you :)
Original comment by danger1...@gmail.com
on 2 Sep 2009 at 4:15
It is Alexey Chebotar :)
Sorry. I was logged in with my old account :(
Original comment by danger1...@gmail.com
on 2 Sep 2009 at 4:18
Sorry for my late work. :<
I have modified code for it on my environment but it's not completed yet...
Original comment by kou...@gmail.com
on 3 Sep 2009 at 11:07
I've implemented "rename" in trunk.
entry.id = "new-rdn-value"
entry.save
But new_superior isn't implemented because Ruby/LDAP doesn't bind
ldap_rename(). :<
Original comment by kou...@gmail.com
on 21 Sep 2009 at 9:07
Thanks for solving, I will try use this all as soon as possible.
And I will thinking about ldap_rename() for Ruby/LDAP :)
Original comment by Alexey.Chebotar@gmail.com
on 21 Sep 2009 at 1:16
Original issue reported on code.google.com by
Alexey.Chebotar@gmail.com
on 6 Aug 2009 at 5:47