diff --git a/src/bk-user/bkuser/apis/web/mixins.py b/src/bk-user/bkuser/apis/web/mixins.py index 4e85a761e..f4b6a903f 100644 --- a/src/bk-user/bkuser/apis/web/mixins.py +++ b/src/bk-user/bkuser/apis/web/mixins.py @@ -18,7 +18,7 @@ class CurrentUserTenantMixin: request: Request - def get_current_tenant_id(self): + def get_current_tenant_id(self) -> str: tenant_id = self.request.user.get_property("tenant_id") if not tenant_id: raise error_codes.GET_CURRENT_TENANT_FAILED diff --git a/src/bk-user/bkuser/apis/web/organization/views.py b/src/bk-user/bkuser/apis/web/organization/views.py index fae3b3acb..6eaf1410a 100644 --- a/src/bk-user/bkuser/apis/web/organization/views.py +++ b/src/bk-user/bkuser/apis/web/organization/views.py @@ -140,7 +140,7 @@ def get_serializer_context(self): def get(self, request, *args, **kwargs): queryset = self.get_tenants() # 将当前租户置顶 - current_tenant_id = self.get_current_tenant_id() + current_tenant_id: str = self.get_current_tenant_id() # 通过比对租户id, 当等于当前登录用户的租户id,将其排序到查询集的顶部, 否则排序到查询集的底部 sorted_queryset = sorted(queryset, key=lambda t: t.id != current_tenant_id)