From db5ff0f9229aa8b755fff51fd125eba8a84268a9 Mon Sep 17 00:00:00 2001 From: BaiJiangJie Date: Tue, 29 Oct 2019 16:37:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=20LDAP/AD=20Source=20=E6=97=B6=E6=8E=92=E9=99=A4=20ad?= =?UTF-8?q?min=20=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/signals_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/authentication/signals_handlers.py b/apps/authentication/signals_handlers.py index 7033cf777..c0b48c61d 100644 --- a/apps/authentication/signals_handlers.py +++ b/apps/authentication/signals_handlers.py @@ -47,7 +47,7 @@ def on_openid_login_success(sender, user=None, request=None, **kwargs): @receiver(populate_user) def on_ldap_create_user(sender, user, ldap_user, **kwargs): - if user and user.name != 'admin': + if user and user.username != 'admin': user.source = user.SOURCE_LDAP user.save() From c7ecfd794305284bb2c3c277e7c6737c061e34d6 Mon Sep 17 00:00:00 2001 From: BaiJiangJie Date: Tue, 29 Oct 2019 17:58:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E5=BD=93?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E8=AE=BE=E7=BD=AE=E5=8C=85=E5=90=AB=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=91=BD=E4=BB=A4=E5=AD=98=E5=82=A8=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=20/docs/=20=E9=A1=B5=E9=9D=A2=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/perms/api/user_remote_app_permission.py | 2 ++ apps/terminal/api/command.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/apps/perms/api/user_remote_app_permission.py b/apps/perms/api/user_remote_app_permission.py index 868c92015..51a9217ce 100644 --- a/apps/perms/api/user_remote_app_permission.py +++ b/apps/perms/api/user_remote_app_permission.py @@ -53,6 +53,8 @@ class UserGrantedRemoteAppsAsTreeApi(UserGrantedRemoteAppsApi): permission_classes = (IsOrgAdminOrAppUser,) def get_serializer(self, remote_apps=None, *args, **kwargs): + if remote_apps is None: + remote_apps = [] only_remote_app = self.request.query_params.get('only', '0') == '1' tree_root = None data = [] diff --git a/apps/terminal/api/command.py b/apps/terminal/api/command.py index c18de010f..1dfd0ad3b 100644 --- a/apps/terminal/api/command.py +++ b/apps/terminal/api/command.py @@ -29,6 +29,9 @@ class CommandQueryMixin: default_days_ago = 5 def get_queryset(self): + # 解决访问 /docs/ 问题 + if hasattr(self, 'swagger_fake_view'): + return self.command_store.model.objects.none() date_from, date_to = self.get_date_range() q = self.request.query_params multi_command_storage = get_multi_command_storage()