File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515from functools import partial
16- import asyncio
1716
1817from casbin .async_management_enforcer import AsyncManagementEnforcer
1918from casbin .util import join_slice , array_remove_duplicates , set_subtract
@@ -23,15 +22,6 @@ class AsyncEnforcer(AsyncManagementEnforcer):
2322 """
2423 AsyncEnforcer = AsyncManagementEnforcer + RBAC_API + RBAC_WITH_DOMAIN_API
2524 """
26- async def enforce (self , * rvals ):
27- loop = asyncio .get_running_loop ()
28- result = await loop .run_in_executor (None , super ().enforce , * rvals )
29- return result
30-
31- async def batch_enforce (self , rvals ):
32- """batch_enforce enforce in batches"""
33- tasks = [self .enforce (* request ) for request in rvals ]
34- return await asyncio .gather (* tasks )
3525
3626 async def get_roles_for_user (self , name ):
3727 """gets the roles that a user has."""
Original file line number Diff line number Diff line change 1515import copy
1616import logging
1717import re
18- import asyncio
1918
2019from casbin .effect import Effector , get_effector , effect_to_bool
2120from casbin .model import Model , FunctionMap
@@ -458,8 +457,6 @@ def enforce_ex(self, *rvals):
458457 expression = self ._get_expression (exp_with_rule , functions )
459458
460459 result = expression .eval (parameters )
461- if asyncio .iscoroutine (result ):
462- result = asyncio .run (result )
463460
464461 if isinstance (result , bool ):
465462 if not result :
You can’t perform that action at this time.
0 commit comments