diff --git a/apps/assets/templates/assets/user_asset_list.html b/apps/assets/templates/assets/user_asset_list.html
index 5c9fa2633..649418aed 100644
--- a/apps/assets/templates/assets/user_asset_list.html
+++ b/apps/assets/templates/assets/user_asset_list.html
@@ -1,81 +1,171 @@
-{% extends '_base_list.html' %}
-{% load i18n %}
+{% extends 'base.html' %}
{% load static %}
+{% load i18n %}
+
{% block custom_head_css_js %}
-
-
-
-{% endblock %}
-{% block content_left_head %}{% endblock %}
-
-{% block table_search %}
+
+
+
{% endblock %}
-{% block table_container %}
-
+{% block content %}
+
{% endblock %}
{% block custom_foot_js %}
-
-
-{% endblock %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/apps/perms/api.py b/apps/perms/api.py
index 148d366db..4f4fa3145 100644
--- a/apps/perms/api.py
+++ b/apps/perms/api.py
@@ -100,33 +100,6 @@ class UserGrantedNodesApi(ListAPIView):
class UserGrantedNodesWithAssetsApi(ListAPIView):
- """
- 授权用户的资产组,注:这里的资产组并非是授权列表中授权的,
- 而是把所有资产取出来,然后反查出所有节点,然后合并得到,
- 结果里也包含资产组下授权的资产
- 数据结构如下:
- [
- {
- "id": 1,
- "value": "node",
- ... 其它属性
- "assets_granted": [
- {
- "id": 1,
- "hostname": "testserver",
- "ip": "192.168.1.1",
- "port": 22,
- "system_users_granted": [
- "id": 1,
- "name": "web",
- "username": "web",
- "protocol": "ssh",
- ]
- }
- ]
- }
- ]
- """
permission_classes = (IsSuperUserOrAppUser,)
serializer_class = NodeGrantedSerializer
@@ -172,6 +145,11 @@ class UserGrantedNodeAssetsApi(ListAPIView):
asset.system_users_granted = system_users
return assets
+ def get_permissions(self):
+ if self.kwargs.get('pk') is None:
+ self.permission_classes = (IsValidUser,)
+ return super().get_permissions()
+
class UserGroupGrantedAssetsApi(ListAPIView):
permission_classes = (IsSuperUser,)
diff --git a/apps/users/models/user.py b/apps/users/models/user.py
index 347848b7b..06761a5df 100644
--- a/apps/users/models/user.py
+++ b/apps/users/models/user.py
@@ -241,7 +241,7 @@ class User(AbstractUser):
def create_app_user(cls, name, comment):
app = cls.objects.create(
username=name, name=name, email='{}@local.domain'.format(name),
- is_active=False, role='App', enable_otp=False, comment=comment,
+ is_active=False, role='App', comment=comment,
is_first_login=False, created_by='System'
)
access_key = app.create_access_key()
diff --git a/apps/users/templates/users/user_profile.html b/apps/users/templates/users/user_profile.html
index 88d963595..f29e1427e 100644
--- a/apps/users/templates/users/user_profile.html
+++ b/apps/users/templates/users/user_profile.html
@@ -65,7 +65,7 @@
{% trans 'OTP' %} |
- {{ user.enable_otp|yesno:"Yes,No,Unkown" }} |
+ {{ user.otp_enabled|yesno:"Yes,No,Unkown" }} |
{% trans 'Public key' %} |
diff --git a/apps/users/views/login.py b/apps/users/views/login.py
index 21c63f889..cd8ce8fca 100644
--- a/apps/users/views/login.py
+++ b/apps/users/views/login.py
@@ -192,8 +192,6 @@ class UserFirstLoginView(LoginRequiredMixin, SessionWizardView):
for field in form:
if field.value():
setattr(user, field.name, field.value())
- if field.name == 'enable_otp':
- user.enable_otp = field.value()
user.is_first_login = False
user.is_public_key_valid = True
user.save()