mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-08 10:22:46 +00:00
Fixed bug in sys useradmin
This commit is contained in:
@@ -96,9 +96,14 @@ class User(object):
|
||||
def save(self):
|
||||
emailuser = ccnet_threaded_rpc.get_emailuser(self.username)
|
||||
if emailuser:
|
||||
ccnet_threaded_rpc.update_emailuser(emailuser.id, self.password,
|
||||
int(self.is_staff),
|
||||
int(self.is_active))
|
||||
if hasattr(self, 'password'): # setted by set_password()
|
||||
ccnet_threaded_rpc.update_emailuser(emailuser.id,
|
||||
self.password,
|
||||
int(self.is_staff),
|
||||
int(self.is_active))
|
||||
else:
|
||||
# TODO: need a new rpc tp update is_staff and is_active
|
||||
raise NotImplementedError
|
||||
else:
|
||||
ccnet_threaded_rpc.add_emailuser(self.username, self.password,
|
||||
int(self.is_staff),
|
||||
|
@@ -31,9 +31,9 @@
|
||||
<a href="#" class="remove-user-btn op" data-url="{{ SITE_ROOT }}useradmin/remove/{{ user.props.id }}/" data-target="{{ user.props.email }}">{% trans "Delete" %}</a>
|
||||
<a href="#" class="reset-user-btn op" data-url="{% url 'user_reset' user.id %}" data-target="{{ user.props.email }}">{% trans "ResetPwd" %}</a>
|
||||
{% if user.is_staff %}
|
||||
<a href="#" class="reset-user-btn op" data-url="{% url 'user_remove_admin' user.id %}" data-target="{{ user.props.email }}">{% trans "Take Admin" %}</a>
|
||||
<a href="#" class="take-admin-btn op" data="{% url 'user_remove_admin' user.id %}">{% trans "Take Admin" %}</a>
|
||||
{% else %}
|
||||
<a href="#" class="reset-user-btn op" data-url="{% url 'user_make_admin' user.id %}" data-target="{{ user.props.email }}">{% trans "Give Admin" %}</a>
|
||||
<a href="#" class="give-admin-btn op" data="{% url 'user_make_admin' user.id %}">{% trans "Give Admin" %}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript">
|
||||
$('.activate').each(function(){
|
||||
$('.activate,.give-admin-btn,take-admin-btn').each(function(){
|
||||
$(this).click(function(){
|
||||
location.href = $(this).attr('data');
|
||||
});
|
||||
|
4
urls.py
4
urls.py
@@ -80,8 +80,8 @@ urlpatterns = patterns('',
|
||||
|
||||
(r'^useradmin/add/$', user_add),
|
||||
(r'^useradmin/remove/(?P<user_id>[^/]+)/$', user_remove),
|
||||
(r'^useradmin/makeadmin/(?P<user_id>[^/]+)/$', user_make_admin),
|
||||
(r'^useradmin/removeadmin/(?P<user_id>[^/]+)/$', user_remove_admin),
|
||||
url(r'^useradmin/makeadmin/(?P<user_id>[^/]+)/$', user_make_admin, name='user_make_admin'),
|
||||
url(r'^useradmin/removeadmin/(?P<user_id>[^/]+)/$', user_remove_admin, name='user_remove_admin'),
|
||||
(r'^useradmin/info/(?P<email>[^/]+)/$', user_info),
|
||||
(r'^useradmin/activate/(?P<user_id>[^/]+)/$', activate_user),
|
||||
url(r'^useradmin/password/reset/(?P<user_id>[^/]+)/$', user_reset, name='user_reset'),
|
||||
|
Reference in New Issue
Block a user