Skip to content

Commit

Permalink
refactor: cr调整
Browse files Browse the repository at this point in the history
  • Loading branch information
neronkl committed Nov 9, 2023
1 parent 0a2aac7 commit 383f286
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bk-user/bkuser/apis/web/tenant_setting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
TenantUserValidityPeriodConfig,
UserBuiltinField,
)
from bkuser.apps.tenant.periodic_tasks import send_tenant_user_expiring_notification
from bkuser.biz.tenant_setting import NotificationTemplate
from bkuser.common.error_codes import error_codes
from bkuser.common.views import ExcludePatchAPIViewMixin, ExcludePutAPIViewMixin

send_tenant_user_expiring_notification()


class TenantUserFieldListApi(CurrentUserTenantMixin, generics.ListAPIView):
pagination_class = None
Expand Down Expand Up @@ -148,6 +151,9 @@ def get(self, request, *args, **kwargs):
def put(self, request, *args, **kwargs):
instance = self.get_queryset().first()

if not instance:
raise error_codes.OBJECT_NOT_FOUND.f(_("账户有效期配置丢失,请联系系统管理员"))

# 边界限制: 当前租户的管理才可做更新操作
operator = request.user.username
if not TenantManager.objects.filter(tenant_id=instance.tenant_id, tenant_user_id=operator).exists():
Expand Down

0 comments on commit 383f286

Please sign in to comment.