diff --git a/seahub/templates/sysadmin/sys_info.html b/seahub/templates/sysadmin/sys_info.html index 8f33949f8c..a6c61174db 100644 --- a/seahub/templates/sysadmin/sys_info.html +++ b/seahub/templates/sysadmin/sys_info.html @@ -15,12 +15,27 @@ {% trans "Upgrade to Pro Edition" %} {% endif %} - +
{% trans "Libraries" %}
{{repos_count}}
-
{% trans "Users" %}
-
{{users_count}} {% if license_dict %}/ {{license_dict.MaxUsers}}{% endif %}
+ {% if is_pro %} +
{% trans "Active Users" %} / {% trans "Total Users" %} / {% trans "Limits" %}
+
+ {% if active_users_count %}{{ active_users_count }}{% else %}--{% endif %} + / + {% if users_count %}{{ users_count }}{% else %}--{% endif %} + / + {% if license_dict %}{{ license_dict.MaxUsers }}{% else %}--{% endif %} +
+ {% else %} +
{% trans "Active Users" %} / {% trans "Total Users" %}
+
+ {% if active_users_count %}{{ active_users_count }}{% else %}--{% endif %} + / + {% if users_count %}{{ users_count }}{% else %}--{% endif %} +
+ {% endif %}
{% trans "Groups" %}
{{groups_count}}
diff --git a/seahub/views/sysadmin.py b/seahub/views/sysadmin.py index ddda76d2a4..e356f3b225 100644 --- a/seahub/views/sysadmin.py +++ b/seahub/views/sysadmin.py @@ -62,20 +62,18 @@ def sys_info(request): Arguments: - `request`: """ - try: - users_count = ccnet_threaded_rpc.count_emailusers('DB') + ccnet_threaded_rpc.count_emailusers('LDAP') - except Exception as e: - logger.error(e) - users_count = 0 + # count repos repos_count = mute_seafile_api.count_repos() + # count groups try: groups_count = len(ccnet_threaded_rpc.get_all_groups(-1, -1)) except Exception as e: logger.error(e) groups_count = 0 + # count orgs if MULTI_TENANCY: try: org_count = ccnet_threaded_rpc.count_orgs() @@ -85,14 +83,47 @@ def sys_info(request): else: org_count = -1 + # count users + try: + active_db_users = ccnet_threaded_rpc.count_emailusers('DB') + except Exception as e: + logger.error(e) + active_db_users = 0 + + try: + active_ldap_users = ccnet_threaded_rpc.count_emailusers('LDAP') + except Exception as e: + logger.error(e) + active_ldap_users = 0 + + try: + inactive_db_users = ccnet_threaded_rpc.count_inactive_emailusers('DB') + except Exception as e: + logger.error(e) + inactive_db_users = 0 + + try: + inactive_ldap_users = ccnet_threaded_rpc.count_inactive_emailusers('LDAP') + except Exception as e: + logger.error(e) + inactive_ldap_users = 0 + + active_users = active_db_users + active_ldap_users if active_ldap_users > 0 \ + else active_db_users + + inactive_users = inactive_db_users + inactive_ldap_users if inactive_ldap_users > 0 \ + else inactive_db_users + is_pro = is_pro_version() if is_pro: license_file = os.path.join(settings.PROJECT_ROOT, '../../seafile-license.txt') license_dict = parse_license(license_file) else: license_dict = {} + return render_to_response('sysadmin/sys_info.html', { - 'users_count': users_count, + 'users_count': active_users + inactive_users, + 'active_users_count': active_users, 'repos_count': repos_count, 'groups_count': groups_count, 'org_count': org_count,