comparison hgext/simple4server.py @ 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 c6dc5822e640
children 2a2db401a55b
comparison
equal deleted inserted replaced
868:3ec90de03562 869:e9eeef0d07ec
15 from mercurial import wireproto 15 from mercurial import wireproto
16 from mercurial import extensions 16 from mercurial import extensions
17 from mercurial import obsolete 17 from mercurial import obsolete
18 from cStringIO import StringIO 18 from cStringIO import StringIO
19 from mercurial import node 19 from mercurial import node
20 from mercurial.hgweb import hgweb_mod
20 _pack = struct.pack 21 _pack = struct.pack
21 22
22 def srv_pushobsmarkers(repo, proto): 23 def srv_pushobsmarkers(repo, proto):
23 """wireprotocol command""" 24 """wireprotocol command"""
24 fp = StringIO() 25 fp = StringIO()
176 return caps 177 return caps
177 178
178 def extsetup(ui): 179 def extsetup(ui):
179 obsolete.obsstore = pruneobsstore 180 obsolete.obsstore = pruneobsstore
180 obsolete.obsstore.relevantmarkers = relevantmarkers 181 obsolete.obsstore.relevantmarkers = relevantmarkers
182 hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push'
183 hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull'
184 hgweb_mod.perms['evoext_obshash'] = 'pull'
181 wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') 185 wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')
182 wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') 186 wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*')
183 extensions.wrapfunction(wireproto, 'capabilities', capabilities) 187 extensions.wrapfunction(wireproto, 'capabilities', capabilities)
184 wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes') 188 wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')