[PATCH 0 of 1] RFC: simple hook support for hgweb.check_perm

Sune Foldager cryo at cyanite.org
Fri Nov 6 13:39:36 UTC 2009


This is for discussion and should not be pushed as-is.

This adds simple support for hooks (provided by hgext modules) in hgweb's
check_perm. The hooks are invoked with the hgweb instance (for access to
a lot of info useful for authentication), the request object and the desired
operation. It should either just return (indicating auth success) or raise
an ErrorResponse exception, which may include authentication headers.

Further on, I think we could add some authentication into hgwebdir as well,
which currently only checks allow_read and deny_read, and pass the hgwebdir
instance to the hook from there. The hook can then check the instance to
see what context it's called from.

The location of the checkpermhooks array in common.py is somewhat arbitrary,
but placed there to avoid conceptually attaching it to hgweb (if we want
hgwebdir auth later on).


More information about the Mercurial-devel mailing list