From 834fc090b524dbc50553bf61dd38aad0bdb1bbab Mon Sep 17 00:00:00 2001 From: zhuo <252618818@qq.com> Date: Thu, 30 Mar 2023 19:10:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=9D=83=E9=99=90=E7=9A=84=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E5=92=8C=E5=A4=84=E7=90=86=E9=AA=8C=E8=AF=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/like/admin/service/system/auth_perm.py | 4 ++-- server/like/dependencies/verify.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/like/admin/service/system/auth_perm.py b/server/like/admin/service/system/auth_perm.py index 066d8c6..5030c7a 100644 --- a/server/like/admin/service/system/auth_perm.py +++ b/server/like/admin/service/system/auth_perm.py @@ -59,8 +59,8 @@ class SystemAuthPermService(ISystemAuthPermService): auth_menus = await db.fetch_all( system_auth_menu.select().where( system_auth_menu.c.is_disable == 0, - system_auth_menu.c.id in menu_ids, - system_auth_menu.c.menu_type in ['C', 'A']) + system_auth_menu.c.id.in_(menu_ids), + system_auth_menu.c.menu_type.in_(['C', 'A'])) .order_by(system_auth_menu.c.menu_sort, system_auth_menu.c.id)) menus = [i.perms for i in auth_menus if i.perms] await RedisUtil.hset(AdminConfig.backstage_roles_key, str(role_id), ','.join(menus)) diff --git a/server/like/dependencies/verify.py b/server/like/dependencies/verify.py index 6c5cf7e..74cdf91 100644 --- a/server/like/dependencies/verify.py +++ b/server/like/dependencies/verify.py @@ -69,13 +69,13 @@ async def verify_token(request: Request): role_ids = mapping.get('role_ids') menus = [] # 校验角色权限是否存在 - for role_id in role_ids: + for role_id in role_ids.split(','): if not await RedisUtil.hexists(AdminConfig.backstage_roles_key, role_id): await SystemAuthPermService.cache_role_menus_by_role_id(role_id) - menus.extend(await RedisUtil.hget(AdminConfig.backstage_roles_key, role_id)) - + menus.extend((await RedisUtil.hget(AdminConfig.backstage_roles_key, role_id)).split(',')) + menus = filter(None, set(menus)) # 验证是否有权限操作 - if not (menus and auths in menus.split(',')): + if not (menus and auths in menus): raise AppException(HttpResp.NO_PERMISSION) -- Gitee From 9538ba8ddd0c8bcfe2d69cd1a0a5a4fce0093262 Mon Sep 17 00:00:00 2001 From: zhuo <252618818@qq.com> Date: Thu, 30 Mar 2023 19:17:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E9=A1=B5=E6=9D=83=E9=99=90=E6=A0=87=E8=AF=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/install.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/install.sql b/sql/install.sql index 3f20d5a..f57ff6c 100644 --- a/sql/install.sql +++ b/sql/install.sql @@ -583,7 +583,7 @@ INSERT INTO `la_article` VALUES (3, 2, '金山电池公布“沪广深市民绿 COMMIT; BEGIN; -INSERT INTO `la_system_auth_menu` VALUES (1, 0, 'C', '工作台', 'el-icon-Monitor', 50, 'index:console', 'workbench', 'workbench/index', '', '', 1, 1, 0, 1650341765, 1668672757); +INSERT INTO `la_system_auth_menu` VALUES (1, 0, 'C', '工作台', 'el-icon-Monitor', 50, 'common:index:console', 'workbench', 'workbench/index', '', '', 1, 1, 0, 1650341765, 1668672757); INSERT INTO `la_system_auth_menu` VALUES (100, 0, 'M', '权限管理', 'el-icon-Lock', 44, '', 'permission', '', '', '', 0, 1, 0, 1650341765, 1662626201); INSERT INTO `la_system_auth_menu` VALUES (101, 100, 'C', '管理员', 'local-icon-wode', 0, 'system:admin:list', 'admin', 'permission/admin/index', '', '', 1, 1, 0, 1650341765, 1663301404); INSERT INTO `la_system_auth_menu` VALUES (102, 101, 'A', '管理员详情', '', 0, 'system:admin:detail', '', '', '', '', 0, 1, 0, 1650341765, 1660201785); -- Gitee From 72e5d5f450849c162b7fc7218c9da5acc55a99ff Mon Sep 17 00:00:00 2001 From: zhuo <252618818@qq.com> Date: Thu, 30 Mar 2023 19:19:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E6=8B=A5=E6=9C=89=E5=A4=9A=E4=B8=AA=E8=A7=92=E8=89=B2=E6=9D=83?= =?UTF-8?q?=E9=99=90bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/like/admin/service/system/auth_admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/like/admin/service/system/auth_admin.py b/server/like/admin/service/system/auth_admin.py index a634d58..d25189a 100644 --- a/server/like/admin/service/system/auth_admin.py +++ b/server/like/admin/service/system/auth_admin.py @@ -87,7 +87,7 @@ class SystemAuthAdminService(ISystemAuthAdminService): # 角色权限 auths = [] if admin_id > 1: - menu_ids = await self.auth_perm_service.select_menu_ids_by_role_id([int(i) for i in sys_admin.role_ids]) + menu_ids = await self.auth_perm_service.select_menu_ids_by_role_id([int(i) for i in sys_admin.role_ids.split(',')]) if menu_ids: menus = await db.fetch_all( system_auth_menu.select() -- Gitee