mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 10:58:33 +00:00
[inst] Update user table
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
{% if users %}
|
{% if users %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="36%">{% trans "Email" %}</th>
|
<th width="36%">{% trans "Email" %} / {% trans "Name" %} / {% trans "Contact Email" %}</th>
|
||||||
<th width="12%">{% trans "Status" %}</th>
|
<th width="12%">{% trans "Status" %}</th>
|
||||||
<th width="16%">{% trans "Space Used" %}</th>
|
<th width="16%">{% trans "Space Used" %}</th>
|
||||||
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
||||||
@@ -22,7 +22,10 @@
|
|||||||
|
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<tr data-userid="{{user.email}}">
|
<tr data-userid="{{user.email}}">
|
||||||
<td><a href="{% url 'institutions:user_info' user.email %}">{{ user.email }}</a>
|
<td>
|
||||||
|
<a href="{% url 'institutions:user_info' user.email %}">{{ user.email }}</a>
|
||||||
|
{% if user.name %}<br />{{ user.name }}{% endif %}
|
||||||
|
{% if user.contact_email %}<br />{{ user.contact_email }}{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="user-status">
|
<div class="user-status">
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
{% if users %}
|
{% if users %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="36%">{% trans "Email" %}</th>
|
<th width="36%">{% trans "Email" %} / {% trans "Name" %} / {% trans "Contact Email" %}</th>
|
||||||
<th width="12%">{% trans "Status" %}</th>
|
<th width="12%">{% trans "Status" %}</th>
|
||||||
<th width="16%">{% trans "Space Used" %}</th>
|
<th width="16%">{% trans "Space Used" %}</th>
|
||||||
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
||||||
@@ -24,7 +24,10 @@
|
|||||||
|
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<tr data-userid="{{user.email}}">
|
<tr data-userid="{{user.email}}">
|
||||||
<td><a href="{% url 'institutions:user_info' user.email %}">{{ user.email }}</a>
|
<td>
|
||||||
|
<a href="{% url 'institutions:user_info' user.email %}">{{ user.email }}</a>
|
||||||
|
{% if user.name %}<br />{{ user.name }}{% endif %}
|
||||||
|
{% if user.contact_email %}<br />{{ user.contact_email }}{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="user-status">
|
<div class="user-status">
|
||||||
|
@@ -21,7 +21,7 @@ from seahub.institutions.decorators import (inst_admin_required,
|
|||||||
from seahub.profile.models import Profile, DetailedProfile
|
from seahub.profile.models import Profile, DetailedProfile
|
||||||
from seahub.utils import is_valid_username, clear_token
|
from seahub.utils import is_valid_username, clear_token
|
||||||
from seahub.utils.rpc import mute_seafile_api
|
from seahub.utils.rpc import mute_seafile_api
|
||||||
from seahub.views.sysadmin import email_user_on_activation
|
from seahub.views.sysadmin import email_user_on_activation, populate_user_info
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -75,6 +75,7 @@ def useradmin(request):
|
|||||||
if u.username == request.user.username:
|
if u.username == request.user.username:
|
||||||
u.is_self = True
|
u.is_self = True
|
||||||
|
|
||||||
|
populate_user_info(u)
|
||||||
_populate_user_quota_usage(u)
|
_populate_user_quota_usage(u)
|
||||||
|
|
||||||
for e in last_logins:
|
for e in last_logins:
|
||||||
@@ -110,6 +111,7 @@ def useradmin_search(request):
|
|||||||
if u.username == request.user.username:
|
if u.username == request.user.username:
|
||||||
u.is_self = True
|
u.is_self = True
|
||||||
|
|
||||||
|
populate_user_info(u)
|
||||||
_populate_user_quota_usage(u)
|
_populate_user_quota_usage(u)
|
||||||
|
|
||||||
for e in last_logins:
|
for e in last_logins:
|
||||||
|
@@ -112,6 +112,17 @@ def can_view_sys_admin_repo(repo):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def populate_user_info(user):
|
||||||
|
"""Populate contact email and nickname to user.
|
||||||
|
"""
|
||||||
|
user_profile = Profile.objects.get_profile_by_user(user.email)
|
||||||
|
if user_profile:
|
||||||
|
user.contact_email = user_profile.contact_email
|
||||||
|
user.name = user_profile.nickname
|
||||||
|
else:
|
||||||
|
user.contact_email = ''
|
||||||
|
user.name = ''
|
||||||
|
|
||||||
def _populate_user_quota_usage(user):
|
def _populate_user_quota_usage(user):
|
||||||
"""Populate space/share quota to user.
|
"""Populate space/share quota to user.
|
||||||
|
|
||||||
@@ -190,17 +201,10 @@ def sys_user_admin(request):
|
|||||||
else:
|
else:
|
||||||
trial_users = []
|
trial_users = []
|
||||||
for user in users:
|
for user in users:
|
||||||
user_profile = Profile.objects.get_profile_by_user(user.email)
|
|
||||||
if user_profile:
|
|
||||||
user.contact_email = user_profile.contact_email
|
|
||||||
user.name = user_profile.nickname
|
|
||||||
else:
|
|
||||||
user.contact_email = ''
|
|
||||||
user.name = ''
|
|
||||||
|
|
||||||
if user.email == request.user.email:
|
if user.email == request.user.email:
|
||||||
user.is_self = True
|
user.is_self = True
|
||||||
|
|
||||||
|
populate_user_info(user)
|
||||||
_populate_user_quota_usage(user)
|
_populate_user_quota_usage(user)
|
||||||
|
|
||||||
# check user's role
|
# check user's role
|
||||||
@@ -1458,16 +1462,9 @@ def user_search(request):
|
|||||||
else:
|
else:
|
||||||
trial_users = []
|
trial_users = []
|
||||||
for user in users:
|
for user in users:
|
||||||
|
populate_user_info(user)
|
||||||
_populate_user_quota_usage(user)
|
_populate_user_quota_usage(user)
|
||||||
|
|
||||||
user_profile = Profile.objects.get_profile_by_user(user.email)
|
|
||||||
if user_profile:
|
|
||||||
user.contact_email = user_profile.contact_email
|
|
||||||
user.name = user_profile.nickname
|
|
||||||
else:
|
|
||||||
user.contact_email = ''
|
|
||||||
user.name = ''
|
|
||||||
|
|
||||||
# check user's role
|
# check user's role
|
||||||
if user.role == GUEST_USER:
|
if user.role == GUEST_USER:
|
||||||
user.is_guest = True
|
user.is_guest = True
|
||||||
|
Reference in New Issue
Block a user