This is somewhat of a tech-preview patch. It works, but the whole concept might need some more work/thinking done.

It adds another way to extend plugins without resorting to the versioning system.


Until now, every baseldap command had two callbacks. The pre-callback called before data was passed to python-ldap and the post-callback called after.

This patch introduces class methods, that enable the registration of new pre/post callbacks. It supports top level functions as well, so you don't have to touch the original class at all.

It works likes this:

from ipalib.plugins.user import user_show

def test_callback(inst, ldap, dn, attrs_list, *keys, **options):
    inst.log.info('hello callback world!')
    attrs_list = ['uid'] # only retrieve the user name
    return dn

user_show.register_pre_callback(test_callback)

The original callbacks defined in the class are always called first.

Pavel

Attachment: 0001-Add-interface-for-baseldap-plugins-to-register-addit.patch
Description: application/mbox

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to