Browse Source

fix: 组织统计里系统用户与特权用户数量不对

pull/6678/head
xinwen 3 years ago committed by Jiangjie.Bai
parent
commit
f9218584f4
  1. 10
      apps/orgs/caches.py

10
apps/orgs/caches.py

@ -54,8 +54,8 @@ class OrgResourceStatisticsCache(OrgRelatedCache):
assets_amount = IntegerField() assets_amount = IntegerField()
nodes_amount = IntegerField(queryset=Node.objects) nodes_amount = IntegerField(queryset=Node.objects)
admin_users_amount = IntegerField(queryset=SystemUser.objects.filter(type=SystemUser.Type.admin)) admin_users_amount = IntegerField()
system_users_amount = IntegerField(queryset=SystemUser.objects.filter(type=SystemUser.Type.common)) system_users_amount = IntegerField()
domains_amount = IntegerField(queryset=Domain.objects) domains_amount = IntegerField(queryset=Domain.objects)
gateways_amount = IntegerField(queryset=Gateway.objects) gateways_amount = IntegerField(queryset=Gateway.objects)
@ -77,6 +77,12 @@ class OrgResourceStatisticsCache(OrgRelatedCache):
def get_current_org(self): def get_current_org(self):
return self.org return self.org
def compute_admin_users_amount(self):
return SystemUser.objects.filter(type=SystemUser.Type.admin).count()
def compute_system_users_amount(self):
return SystemUser.objects.filter(type=SystemUser.Type.common).count()
def compute_users_amount(self): def compute_users_amount(self):
users = User.objects.exclude(role='App') users = User.objects.exclude(role='App')

Loading…
Cancel
Save