From f9bc7ec4aab66f068ac3774c338ba554c2028867 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 12 Jun 2023 18:20:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E8=BF=87=E6=BB=A4=20acl=20=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/models/connection_token.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/authentication/models/connection_token.py b/apps/authentication/models/connection_token.py index e0793c7dc..f1db30d7f 100644 --- a/apps/authentication/models/connection_token.py +++ b/apps/authentication/models/connection_token.py @@ -16,6 +16,7 @@ from common.exceptions import JMSException from common.utils import lazyproperty, pretty_string, bulk_get from common.utils.timezone import as_current_tz from orgs.mixins.models import JMSOrgBaseModel +from orgs.utils import tmp_to_org from terminal.models import Applet @@ -253,9 +254,10 @@ class ConnectionToken(JMSOrgBaseModel): kwargs = { 'user': self.user, 'asset': self.asset, - 'account': self.account_object, + 'account_username': self.account, } - acls = CommandFilterACL.filter_queryset(**kwargs).valid() + with tmp_to_org(self.asset.org_id): + acls = CommandFilterACL.filter_queryset(**kwargs).valid() return acls From 09a5b63240ff4485de347bae17079c3d430f578e Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 12 Jun 2023 18:28:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=20acl=20filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/models/connection_token.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/authentication/models/connection_token.py b/apps/authentication/models/connection_token.py index f1db30d7f..0407cf025 100644 --- a/apps/authentication/models/connection_token.py +++ b/apps/authentication/models/connection_token.py @@ -254,7 +254,7 @@ class ConnectionToken(JMSOrgBaseModel): kwargs = { 'user': self.user, 'asset': self.asset, - 'account_username': self.account, + 'account': self.account_object, } with tmp_to_org(self.asset.org_id): acls = CommandFilterACL.filter_queryset(**kwargs).valid()