正式给指令添加权限限制
This commit is contained in:
parent
5a331e773d
commit
31098af84b
@ -3,7 +3,7 @@ from dataclasses import dataclass
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Optional, List, Union, Literal, Dict, Any
|
from typing import Optional, List, Union, Literal, Dict, Any
|
||||||
|
|
||||||
from casbin import Enforcer
|
from casbin import Enforcer, AsyncEnforcer
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
from sanic.log import logger
|
from sanic.log import logger
|
||||||
@ -117,6 +117,8 @@ class SioDecorator:
|
|||||||
room_id = self.data['roomId']
|
room_id = self.data['roomId']
|
||||||
|
|
||||||
if sender_id != self.app.ctx.sio_config.self_id:
|
if sender_id != self.app.ctx.sio_config.self_id:
|
||||||
|
e: AsyncEnforcer = self.app.ctx.e
|
||||||
|
if e.enforce(str(sender_id), self._cmd[0][1:]):
|
||||||
parser = ArgumentParser(self._cmd[0])
|
parser = ArgumentParser(self._cmd[0])
|
||||||
|
|
||||||
sqt = SioRequest(app=self.app,
|
sqt = SioRequest(app=self.app,
|
||||||
|
Loading…
Reference in New Issue
Block a user