[Update] 修改小问题 (#2100)

* [Update] 不修改admin用户的用户来源

* [Bugfix] 修复Default组织下用户列表会显示所有用户,并查看详情会报错

* [Update] 关闭telnet资产测试可连接性

* [Update] 只有ssh协议资产可测试连接性
pull/2102/head^2
BaiJiangJie 6 years ago committed by 老广
parent 060248d1ca
commit f380d82b55

@ -159,7 +159,7 @@
</span>
</td>
</tr>
{% if asset.is_unixlike %}
{% if asset.protocol == 'ssh' %}
<tr>
<td>{% trans 'Refresh hardware' %}:</td>
<td>

@ -1,7 +1,8 @@
from django.http.request import QueryDict
from django.contrib.auth.signals import user_logged_out
from django.dispatch import receiver
from django.conf import settings
from django.dispatch import receiver
from django.contrib.auth.signals import user_logged_out
from django_auth_ldap.backend import populate_user
from .openid import client
from .signals import post_create_openid_user
@ -31,3 +32,9 @@ def on_post_create_openid_user(sender, user=None, **kwargs):
user.source = user.SOURCE_OPENID
user.save()
@receiver(populate_user)
def on_ldap_create_user(sender, user, ldap_user, **kwargs):
if user and user.name != 'admin':
user.source = user.SOURCE_LDAP
user.save()

@ -39,7 +39,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet):
def get_queryset(self):
queryset = super().get_queryset()
if current_org.is_real():
if current_org.is_real() or current_org.is_default():
org_users = current_org.get_org_users()
queryset = queryset.filter(id__in=org_users)
return queryset

@ -2,7 +2,6 @@
#
from django.dispatch import receiver
from django_auth_ldap.backend import populate_user
# from django.db.models.signals import post_save
from common.utils import get_logger
@ -30,9 +29,3 @@ def on_user_create(sender, user=None, **kwargs):
if user.email:
send_user_created_mail(user)
@receiver(populate_user)
def on_ldap_create_user(sender, user, ldap_user, **kwargs):
if user:
user.source = user.SOURCE_LDAP
user.save()

Loading…
Cancel
Save