mirror of https://github.com/jumpserver/jumpserver
commit
eb93e634e0
|
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -17,7 +17,7 @@ __all__ = [
|
||||||
|
|
||||||
class CommandFilter(OrgModelMixin):
|
class CommandFilter(OrgModelMixin):
|
||||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
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'))
|
is_active = models.BooleanField(default=True, verbose_name=_('Is active'))
|
||||||
comment = models.TextField(blank=True, default='', verbose_name=_("Comment"))
|
comment = models.TextField(blank=True, default='', verbose_name=_("Comment"))
|
||||||
date_created = models.DateTimeField(auto_now_add=True)
|
date_created = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
|
@ -22,7 +22,6 @@ class CommandFilterSerializer(BulkOrgResourceModelSerializer):
|
||||||
|
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
'rules': {'read_only': True},
|
'rules': {'read_only': True},
|
||||||
'system_users': {'read_only': True}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<a class="btn btn-outline btn-default" href="{% url 'assets:cmd-filter-update' pk=object.id %}"><i class="fa fa-edit"></i>{% trans 'Update' %}</a>
|
<a class="btn btn-outline btn-default" href="{% url 'assets:cmd-filter-update' pk=object.id %}"><i class="fa fa-edit"></i>{% trans 'Update' %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
<a class="btn btn-outline btn-danger btn-del">
|
<a class="btn btn-outline btn-danger btn-del btn-delete-cmd-filter">
|
||||||
<i class="fa fa-trash-o"></i>{% trans 'Delete' %}
|
<i class="fa fa-trash-o"></i>{% trans 'Delete' %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -164,5 +164,13 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
updateCMDFilterSystemUsers(system_users)
|
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);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<a class="btn btn-outline btn-default" href="{% url 'assets:domain-update' pk=object.id %}"><i class="fa fa-edit"></i>{% trans 'Update' %}</a>
|
<a class="btn btn-outline btn-default" href="{% url 'assets:domain-update' pk=object.id %}"><i class="fa fa-edit"></i>{% trans 'Update' %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
<a class="btn btn-outline btn-danger btn-del">
|
<a class="btn btn-outline btn-danger btn-del btn-delete-domain">
|
||||||
<i class="fa fa-trash-o"></i>{% trans 'Delete' %}
|
<i class="fa fa-trash-o"></i>{% trans 'Delete' %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -127,6 +127,15 @@ $(document).ready(function(){
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
$data_table.ajax.reload();
|
$data_table.ajax.reload();
|
||||||
}, 3000);
|
}, 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);
|
||||||
|
})
|
||||||
|
;
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -174,6 +174,8 @@ class GrantAssetsMixin(LabelFilterMixin):
|
||||||
system_user = system_users_map.get(sid)
|
system_user = system_users_map.get(sid)
|
||||||
if not system_user:
|
if not system_user:
|
||||||
continue
|
continue
|
||||||
|
if not asset.has_protocol(system_user.protocol):
|
||||||
|
continue
|
||||||
system_user.actions = action
|
system_user.actions = action
|
||||||
system_users_granted.append(system_user)
|
system_users_granted.append(system_user)
|
||||||
asset.system_users_granted = system_users_granted
|
asset.system_users_granted = system_users_granted
|
||||||
|
|
|
@ -256,6 +256,8 @@ class UserGrantedNodesWithAssetsApi(UserPermissionCacheMixin, NodesWithUngroupMi
|
||||||
system_user = _system_users_map.get(system_user_id)
|
system_user = _system_users_map.get(system_user_id)
|
||||||
if not system_user:
|
if not system_user:
|
||||||
continue
|
continue
|
||||||
|
if not asset.has_protocol(system_user.protocol):
|
||||||
|
continue
|
||||||
system_user.actions = action
|
system_user.actions = action
|
||||||
system_user_granted.append(system_user)
|
system_user_granted.append(system_user)
|
||||||
asset.system_users_granted = system_user_granted
|
asset.system_users_granted = system_user_granted
|
||||||
|
|
|
@ -1110,6 +1110,7 @@ function objectAttrsIsBool(obj, attrs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanDate(d) {
|
function cleanDate(d) {
|
||||||
|
if (typeof d === 'number'){return d}
|
||||||
for (var i=0; i<2; i++) {
|
for (var i=0; i<2; i++) {
|
||||||
if (isNaN(Date.parse(d))) {
|
if (isNaN(Date.parse(d))) {
|
||||||
d = d.split('+')[0].trimRight();
|
d = d.split('+')[0].trimRight();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<script src="{% static "js/plugins/toastr/toastr.min.js" %}"></script>
|
<script src="{% static "js/plugins/toastr/toastr.min.js" %}"></script>
|
||||||
<script src="{% static "js/inspinia.js" %}"></script>
|
<script src="{% static "js/inspinia.js" %}"></script>
|
||||||
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
|
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
|
||||||
<script src="{% static "js/jumpserver.js" %}"></script>
|
<script src="{% static "js/jumpserver.js" %}?v=1"></script>
|
||||||
<script>
|
<script>
|
||||||
activeNav();
|
activeNav();
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
Loading…
Reference in New Issue