Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 180f35d

Browse files
committed
auth: passwd: use JsonRpcMethod class instead of plain methods
Signed-off-by: Florian Scherf <f.scherf@pengutronix.de>
1 parent 564ddcc commit 180f35d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

aiohttp_json_rpc/auth/passwd.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hashlib
44
import os
55

6+
from aiohttp_json_rpc.rpc import JsonRpcMethod
67
from .. import RpcInvalidParamsError
78
from . import login_required
89

@@ -116,6 +117,8 @@ def _login(self, username, password):
116117
return None, set()
117118

118119
def _is_authorized(self, request, method):
120+
method = method.method
121+
119122
if hasattr(method, 'login_required') and not request.user:
120123
return False
121124

@@ -137,11 +140,11 @@ def prepare_request(self, request):
137140
request.methods = {}
138141

139142
method_pool = dict(
140-
login=self.login,
141-
logout=self.logout,
142-
create_user=self.create_user,
143-
delete_user=self.delete_user,
144-
set_password=self.set_password,
143+
login=JsonRpcMethod(self.login),
144+
logout=JsonRpcMethod(self.logout),
145+
create_user=JsonRpcMethod(self.create_user),
146+
delete_user=JsonRpcMethod(self.delete_user),
147+
set_password=JsonRpcMethod(self.set_password),
145148
**request.rpc.methods
146149
)
147150

0 commit comments

Comments
 (0)