From 668e29b5795245fa1606fb2145f8afe4d1f1cff8 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 21 Mar 2026 16:14:23 +0800 Subject: [PATCH] bugfix --- rbac/check_perm.py | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/rbac/check_perm.py b/rbac/check_perm.py index 5c6bc3d..350982a 100644 --- a/rbac/check_perm.py +++ b/rbac/check_perm.py @@ -160,32 +160,13 @@ where c.userid = ${userid}$ userid = await getAuthenticationUserid(sor, request) uperm = UserPermissions() ret = await uperm.is_user_has_path_perm(userid, path) - roles = await uperm.get_user_roles(userid) - rp_keys = [k for k in uperm.rp_caches.keys()] - debug(f'{userid=}, {path=} permission is {ret},userroles={roles}, {rp_keys}') + """ + if not ret: + roles = await uperm.get_user_roles(userid) + rp_keys = [k for k in uperm.rp_caches.keys()] + debug(f'{userid=}, {path=} permission is {ret},userroles={roles}') + """ return ret - """ - - perms = await sor.R('permission', {'path':path}) - if len(perms) == 0: - debug(f'{path=} not found in permission, can access') - return True - if userid is None: - debug(f'{userid=} is None, can not access {path=}') - return False - - recs = await sor.sqlExe(sql, {'path':path, 'userid':userid}) - for r in recs: - id = r['id'] - if id is not None: - debug(f'{userid=} can access {path=}') - return True - debug(f'{userid=} has not permission to call {path=}') - return False - e = db.e_except - debug(f'objcheckperm() error happened {userid}, {path}, {e}\n{format_exc()}') - return False - """ registered_auth_methods = { "Basic ": basic_auth