mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
Merge pull request #800 from haiwen/active-users
show active users count at sys info page
This commit is contained in:
@@ -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