On Mon, Aug 14, 2006 at 12:51:47PM -0600, Scott Paul Robertson wrote:
> Anyhow, let me know if you have any thoughts, and I'll have the patch in
> tonight.
> 

Patch is in place. I'm aware of a trailing sentence in the doc string
and a typo with get_user() in the doc string as well, but won't worry
about that till it's be checked and tested.

So now if you want to change the model for the user you simply:

class MyBackend(LDAPBackend):
    def _get_user_by_name(self, username):
        return Model.objects.get(username=username)

    def _create_user_object(self, username, password):
        return Model(username, password)

    def get_user(self, userid):
        try:
            return Model.objects.get(pk=userid)
        except:
            return None

And you can change the generation of the bind string like so:
class MyBackend(LDAPBackend):
    _pre_bind = LDAPBackend.mk_pre_auth_bind('user', 'pass')

It seems pretty clean to me, and allows for more flexibility. Let me
know what all of you think, and if there is anything else that should
change.

Scott

(http://code.djangoproject.com/ticket/2507)

-- 
Scott Paul Robertson
http://spr.mahonri5.net
GnuPG FingerPrint: 09ab 64b5 edc0 903e 93ce edb9 3bcc f8fb dc5d 7601

Attachment: pgpAinNrT2ksA.pgp
Description: PGP signature

Reply via email to