Mercurial > hg > evolve
changeset 869:e9eeef0d07ec
exchange: enforce permission on new wireprotocol command
hgweb needs an explicit declaration of the permission level of each commands.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 06 Mar 2014 12:15:04 -0800 |
parents | 3ec90de03562 |
children | 1a23c7c52a43 |
files | hgext/evolve.py hgext/simple4server.py |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -64,6 +64,7 @@ from mercurial.node import nullid from mercurial import wireproto from mercurial import localrepo +from mercurial.hgweb import hgweb_mod _pack = struct.pack @@ -2448,6 +2449,9 @@ @eh.extsetup def _installwireprotocol(ui): localrepo.MODERNCAPS.add('_evoext_pullobsmarkers_0') + hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push' + hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull' + hgweb_mod.perms['evoext_obshash'] = 'pull' wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')
--- a/hgext/simple4server.py +++ b/hgext/simple4server.py @@ -17,6 +17,7 @@ from mercurial import obsolete from cStringIO import StringIO from mercurial import node +from mercurial.hgweb import hgweb_mod _pack = struct.pack def srv_pushobsmarkers(repo, proto): @@ -178,6 +179,9 @@ def extsetup(ui): obsolete.obsstore = pruneobsstore obsolete.obsstore.relevantmarkers = relevantmarkers + hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push' + hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull' + hgweb_mod.perms['evoext_obshash'] = 'pull' wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') extensions.wrapfunction(wireproto, 'capabilities', capabilities)