From 046356728aa3f7d6ab08b2b815c5eb9097880f2f Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Thu, 21 Jul 2022 13:51:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?perf:=20sso=20token=20=E6=9C=80=E5=B0=8F60?= =?UTF-8?q?=E7=A7=92=20(#8642)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng626 <1304903146@qq.com> --- apps/settings/serializers/auth/sso.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/settings/serializers/auth/sso.py b/apps/settings/serializers/auth/sso.py index c04f38920..113391b45 100644 --- a/apps/settings/serializers/auth/sso.py +++ b/apps/settings/serializers/auth/sso.py @@ -1,4 +1,3 @@ - from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers @@ -14,5 +13,5 @@ class SSOSettingSerializer(serializers.Serializer): ) AUTH_SSO_AUTHKEY_TTL = serializers.IntegerField( required=False, label=_('SSO auth key TTL'), help_text=_("Unit: second"), - min_value=1, max_value=60*30 + min_value=60, max_value=60 * 30 ) From 36d0b8d085d0285525d4b74b59615e006d89a5de Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Thu, 21 Jul 2022 15:31:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E7=BB=84=E4=BB=B6=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/orgs/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/orgs/models.py b/apps/orgs/models.py index c4208d7d0..4bcb14e33 100644 --- a/apps/orgs/models.py +++ b/apps/orgs/models.py @@ -16,9 +16,14 @@ class OrgRoleMixin: def add_member(self, user, role=None): from rbac.builtin import BuiltinRole from .utils import tmp_to_org - role_id = BuiltinRole.org_user.id + if role: role_id = role.id + elif user.is_service_account: + role_id = BuiltinRole.system_component.id + else: + role_id = BuiltinRole.org_user.id + with tmp_to_org(self): defaults = { 'user': user, 'role_id': role_id, From 9d17f27fb3988a91e9819d12c535654945fcccd8 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 21 Jul 2022 15:31:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E8=A7=A3=E5=AF=86=E5=A4=B1=E8=B4=A5=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils/crypto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/utils/crypto.py b/apps/common/utils/crypto.py index 331f8b0bb..0c818ec5b 100644 --- a/apps/common/utils/crypto.py +++ b/apps/common/utils/crypto.py @@ -259,7 +259,7 @@ def decrypt_password(value): aes = get_aes_crypto(aes_key, 'ECB') try: password = aes.decrypt(password_cipher) - except UnicodeDecodeError as e: + except Exception as e: logging.error("Decrypt password error: {}, {}".format(password_cipher, e)) return value return password