mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 01:44:13 +00:00
Merge pull request #800 from haiwen/active-users
show active users count at sys info page
This commit is contained in:
@@ -19,8 +19,23 @@
|
||||
<dt>{% trans "Libraries" %}</dt>
|
||||
<dd>{{repos_count}}</dd>
|
||||
|
||||
<dt>{% trans "Users" %}</dt>
|
||||
<dd>{{users_count}} {% if license_dict %}/ {{license_dict.MaxUsers}}{% endif %}</dd>
|
||||
{% if is_pro %}
|
||||
<dt>{% trans "Active Users" %} / {% trans "Total Users" %} / {% trans "Limits" %}</dt>
|
||||
<dd>
|
||||
{% if active_users_count %}{{ active_users_count }}{% else %}--{% endif %}
|
||||
/
|
||||
{% if users_count %}{{ users_count }}{% else %}--{% endif %}
|
||||
/
|
||||
{% if license_dict %}{{ license_dict.MaxUsers }}{% else %}--{% endif %}
|
||||
</dd>
|
||||
{% else %}
|
||||
<dt>{% trans "Active Users" %} / {% trans "Total Users" %}</dt>
|
||||
<dd>
|
||||
{% if active_users_count %}{{ active_users_count }}{% else %}--{% endif %}
|
||||
/
|
||||
{% if users_count %}{{ users_count }}{% else %}--{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{% trans "Groups" %}</dt>
|
||||
<dd>{{groups_count}}</dd>
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user