File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
- __version__ = "0.6.0 "
1
+ __version__ = "0.6.0a6 "
2
2
__url__ = "https://github.com/amisadmin/fastapi_user_auth"
3
3
4
4
import gettext
Original file line number Diff line number Diff line change 15
15
from fastapi_user_auth .admin import UserRegFormAdmin as DefaultUserRegFormAdmin
16
16
from fastapi_user_auth .admin .utils import get_admin_action_options_by_subject
17
17
from fastapi_user_auth .auth import AuthRouter
18
+ from fastapi_user_auth .auth .schemas import SystemUserEnum
18
19
19
20
20
21
class UserAuthApp (AdminApp , AuthRouter ):
@@ -65,11 +66,9 @@ def register_router(self):
65
66
@self .router .get ("/site_admin_actions_options" , response_model = BaseApiOut )
66
67
async def site_admin_actions_options (request : Request ):
67
68
# 获取当前登录用户的权限
68
- user = await self .auth .get_current_user (request )
69
+ username = await self .auth .get_current_user_identity (request ) or SystemUserEnum . GUEST
69
70
# 获取当前用户的权限列表
70
- options = get_admin_action_options_by_subject (
71
- enforcer = self .auth .enforcer , subject = "u:" + user .username , group = self .site
72
- )
71
+ options = get_admin_action_options_by_subject (enforcer = self .auth .enforcer , subject = "u:" + username , group = self .site )
73
72
return BaseApiOut (data = options )
74
73
75
74
return self
You can’t perform that action at this time.
0 commit comments