diff --git a/apps/assets/migrations/0036_auto_20190716_1535.py b/apps/assets/migrations/0036_auto_20190716_1535.py
new file mode 100644
index 000000000..317d427f0
--- /dev/null
+++ b/apps/assets/migrations/0036_auto_20190716_1535.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.7 on 2019-07-16 07:35
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('assets', '0035_auto_20190711_2018'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='commandfilter',
+ name='name',
+ field=models.CharField(max_length=64, unique=True, verbose_name='Name'),
+ ),
+ ]
diff --git a/apps/assets/models/cmd_filter.py b/apps/assets/models/cmd_filter.py
index 5bd031187..92135894c 100644
--- a/apps/assets/models/cmd_filter.py
+++ b/apps/assets/models/cmd_filter.py
@@ -17,7 +17,7 @@ __all__ = [
class CommandFilter(OrgModelMixin):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
- name = models.CharField(max_length=64, verbose_name=_("Name"))
+ name = models.CharField(max_length=64, unique=True, verbose_name=_("Name"))
is_active = models.BooleanField(default=True, verbose_name=_('Is active'))
comment = models.TextField(blank=True, default='', verbose_name=_("Comment"))
date_created = models.DateTimeField(auto_now_add=True)
diff --git a/apps/assets/serializers/cmd_filter.py b/apps/assets/serializers/cmd_filter.py
index 3f29ca686..da0367c46 100644
--- a/apps/assets/serializers/cmd_filter.py
+++ b/apps/assets/serializers/cmd_filter.py
@@ -22,7 +22,6 @@ class CommandFilterSerializer(BulkOrgResourceModelSerializer):
extra_kwargs = {
'rules': {'read_only': True},
- 'system_users': {'read_only': True}
}
diff --git a/apps/assets/templates/assets/cmd_filter_detail.html b/apps/assets/templates/assets/cmd_filter_detail.html
index b98828f4e..e68cba47c 100644
--- a/apps/assets/templates/assets/cmd_filter_detail.html
+++ b/apps/assets/templates/assets/cmd_filter_detail.html
@@ -29,7 +29,7 @@
{% trans 'Update' %}
-
+
{% trans 'Delete' %}
@@ -164,5 +164,13 @@ $(document).ready(function () {
});
updateCMDFilterSystemUsers(system_users)
})
+.on('click', '.btn-delete-cmd-filter', function () {
+ var $this = $(this);
+ var name = "{{object.name }}";
+ var uid = "{{ object.id }}";
+ var the_url = '{% url "api-assets:cmd-filter-detail" pk=DEFAULT_PK %}'.replace('{{ DEFAULT_PK }}', uid);
+ var redirect_url = "{% url 'assets:cmd-filter-list' %}";
+ objectDelete($this, name, the_url, redirect_url);
+})
{% endblock %}
diff --git a/apps/assets/templates/assets/domain_detail.html b/apps/assets/templates/assets/domain_detail.html
index e60daa334..06fd0d28d 100644
--- a/apps/assets/templates/assets/domain_detail.html
+++ b/apps/assets/templates/assets/domain_detail.html
@@ -24,7 +24,7 @@
{% trans 'Update' %}
-
+
{% trans 'Delete' %}
@@ -127,6 +127,15 @@ $(document).ready(function(){
setTimeout( function () {
$data_table.ajax.reload();
}, 3000);
-});
+})
+.on('click', '.btn-delete-domain', function () {
+ var $this = $(this);
+ var name = "{{ object.name }}";
+ var uid = "{{ object.id }}";
+ var the_url = '{% url "api-assets:domain-detail" pk=DEFAULT_PK %}'.replace('{{ DEFAULT_PK }}', uid);
+ var redirect_url = "{% url 'assets:domain-list' %}";
+ objectDelete($this, name, the_url, redirect_url);
+})
+;
{% endblock %}
\ No newline at end of file
diff --git a/apps/perms/api/mixin.py b/apps/perms/api/mixin.py
index 24bd9abd2..9c726691f 100644
--- a/apps/perms/api/mixin.py
+++ b/apps/perms/api/mixin.py
@@ -174,6 +174,8 @@ class GrantAssetsMixin(LabelFilterMixin):
system_user = system_users_map.get(sid)
if not system_user:
continue
+ if not asset.has_protocol(system_user.protocol):
+ continue
system_user.actions = action
system_users_granted.append(system_user)
asset.system_users_granted = system_users_granted
diff --git a/apps/perms/api/user_permission.py b/apps/perms/api/user_permission.py
index 0746252cb..13ee07951 100644
--- a/apps/perms/api/user_permission.py
+++ b/apps/perms/api/user_permission.py
@@ -256,6 +256,8 @@ class UserGrantedNodesWithAssetsApi(UserPermissionCacheMixin, NodesWithUngroupMi
system_user = _system_users_map.get(system_user_id)
if not system_user:
continue
+ if not asset.has_protocol(system_user.protocol):
+ continue
system_user.actions = action
system_user_granted.append(system_user)
asset.system_users_granted = system_user_granted
diff --git a/apps/static/js/jumpserver.js b/apps/static/js/jumpserver.js
index c880a5499..ad1ec17f5 100644
--- a/apps/static/js/jumpserver.js
+++ b/apps/static/js/jumpserver.js
@@ -1110,6 +1110,7 @@ function objectAttrsIsBool(obj, attrs) {
}
function cleanDate(d) {
+ if (typeof d === 'number'){return d}
for (var i=0; i<2; i++) {
if (isNaN(Date.parse(d))) {
d = d.split('+')[0].trimRight();
diff --git a/apps/templates/_foot_js.html b/apps/templates/_foot_js.html
index 44c351c10..8dbfc0f70 100644
--- a/apps/templates/_foot_js.html
+++ b/apps/templates/_foot_js.html
@@ -7,7 +7,7 @@
-
+