comparison mercurial/wireprototypes.py @ 36801:66de4555cefd

wireproto: formalize permissions checking as part of protocol interface Per the inline comment desiring to formalize permissions checking in the protocol interface, we do that. I'm not convinced this is the best way to go about things. I would love for there to e.g. be a better exception for denoting permissions problems. But it does feel strictly better than snipping attributes on the proto instance. Differential Revision: https://phab.mercurial-scm.org/D2719
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 07 Mar 2018 16:18:52 -0800
parents 6e585bca962e
children 1cfef5693203
comparison
equal deleted inserted replaced
36800:0b18604db95e 36801:66de4555cefd
144 144
145 Receives the list of capabilities collected so far. 145 Receives the list of capabilities collected so far.
146 146
147 Returns a list of capabilities. The passed in argument can be returned. 147 Returns a list of capabilities. The passed in argument can be returned.
148 """ 148 """
149
150 @abc.abstractmethod
151 def checkperm(self, perm):
152 """Validate that the client has permissions to perform a request.
153
154 The argument is the permission required to proceed. If the client
155 doesn't have that permission, the exception should raise or abort
156 in a protocol specific manner.
157 """