Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
8a5d0b2d
Commit
8a5d0b2d
authored
Jan 26, 2017
by
xiaokong1937@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused templatetags: users_tags and common_tags
parent
f3647ea4
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
37 additions
and
133 deletions
+37
-133
admin_user_detail.html
apps/assets/templates/assets/admin_user_detail.html
+1
-4
asset_detail.html
apps/assets/templates/assets/asset_detail.html
+0
-1
asset_group_detail.html
apps/assets/templates/assets/asset_group_detail.html
+1
-4
asset_list.html
apps/assets/templates/assets/asset_list.html
+1
-3
asset_tag_detail.html
apps/assets/templates/assets/asset_tag_detail.html
+1
-4
asset_tags_list.html
apps/assets/templates/assets/asset_tags_list.html
+1
-3
idc_assets.html
apps/assets/templates/assets/idc_assets.html
+1
-4
idc_detail.html
apps/assets/templates/assets/idc_detail.html
+1
-4
system_user_asset.html
apps/assets/templates/assets/system_user_asset.html
+1
-4
system_user_asset_group.html
apps/assets/templates/assets/system_user_asset_group.html
+1
-4
system_user_detail.html
apps/assets/templates/assets/system_user_detail.html
+1
-4
system_user_list.html
apps/assets/templates/assets/system_user_list.html
+0
-1
command_log_list.html
apps/audits/templates/audits/command_log_list.html
+0
-1
proxy_log_detail.html
apps/audits/templates/audits/proxy_log_detail.html
+0
-1
proxy_log_list.html
apps/audits/templates/audits/proxy_log_list.html
+0
-1
detail.html
apps/ops/templates/cron/detail.html
+0
-2
detail.html
apps/ops/templates/sudo/detail.html
+0
-2
detail.html
apps/ops/templates/task/detail.html
+0
-2
asset_permission_asset.html
apps/perms/templates/perms/asset_permission_asset.html
+1
-4
asset_permission_detail.html
apps/perms/templates/perms/asset_permission_detail.html
+1
-4
asset_permission_list.html
apps/perms/templates/perms/asset_permission_list.html
+0
-1
asset_permission_user.html
apps/perms/templates/perms/asset_permission_user.html
+1
-4
_base_list.html
apps/templates/_base_list.html
+0
-1
user.py
apps/users/models/user.py
+15
-3
user_asset_permission.html
apps/users/templates/users/user_asset_permission.html
+1
-4
user_detail.html
apps/users/templates/users/user_detail.html
+1
-3
user_granted_asset.html
apps/users/templates/users/user_granted_asset.html
+1
-4
user_group_asset_permission.html
apps/users/templates/users/user_group_asset_permission.html
+1
-4
user_group_granted_asset.html
apps/users/templates/users/user_group_granted_asset.html
+1
-4
user_profile.html
apps/users/templates/users/user_profile.html
+4
-7
__init__.py
apps/users/templatetags/__init__.py
+0
-0
users_tags.py
apps/users/templatetags/users_tags.py
+0
-38
user.py
apps/users/views/user.py
+0
-3
No files found.
apps/assets/templates/assets/admin_user_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -396,4 +394,4 @@ $(document).ready(function () {
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/asset_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load static %}
{% load i18n %}
...
...
apps/assets/templates/assets/asset_group_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -395,4 +393,4 @@ $(document).ready(function () {
})
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/asset_list.html
View file @
8a5d0b2d
{% extends '_base_list.html' %}
{% load i18n %}
{% load static %}
{% load common_tags %}
{% block custom_head_css_js %}
<link
href=
"{% static 'css/plugins/select2/select2.min.css' %}"
rel=
"stylesheet"
>
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
...
...
@@ -325,4 +324,4 @@ $(document).ready(function(){
$
(
'#asset_bulk_update_modal'
).
modal
(
'hide'
);
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/asset_tag_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -276,4 +274,4 @@ $(document).ready(function () {
deleteTagAssets
(
$this
,
name
,
the_url
,
data
);
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/asset_tags_list.html
View file @
8a5d0b2d
{% extends '_base_list.html' %}
{% load i18n static %}
{#{% load common_tags %}#}
{% block custom_head_css_js %}
<link
href=
"{% static 'css/plugins/select2/select2.min.css' %}"
rel=
"stylesheet"
>
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
...
...
@@ -123,4 +122,4 @@ $(document).ready(function () {
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/idc_assets.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -365,4 +363,4 @@ $(document).ready(function () {
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/idc_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -156,4 +154,4 @@ $(document).ready(function () {
idcDelete
(
name
,
the_url
);
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/system_user_asset.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -370,4 +368,4 @@ $(document).ready(function () {
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/system_user_asset_group.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -133,4 +131,4 @@
$
(
'.select2'
).
select2
();
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/system_user_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -184,4 +182,4 @@
$
(
'.select2'
).
select2
();
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/assets/templates/assets/system_user_list.html
View file @
8a5d0b2d
{% extends '_base_list.html' %}
{% load i18n %}
{% load common_tags %}
{% block table_search %}
{% endblock %}
...
...
apps/audits/templates/audits/command_log_list.html
View file @
8a5d0b2d
{% extends '_base_list.html' %}
{% load i18n %}
{% load static %}
{% load common_tags %}
{% block content_left_head %}
<link
href=
"{% static "
css
/
plugins
/
footable
/
footable
.
core
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static 'css/plugins/datepicker/datepicker3.css' %}"
rel=
"stylesheet"
>
...
...
apps/audits/templates/audits/proxy_log_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load static %}
{% load i18n %}
...
...
apps/audits/templates/audits/proxy_log_list.html
View file @
8a5d0b2d
{% extends '_base_list.html' %}
{% load i18n %}
{% load static %}
{% load common_tags %}
{% block content_left_head %}
<link
href=
"{% static 'css/plugins/datepicker/datepicker3.css' %}"
rel=
"stylesheet"
>
<style>
...
...
apps/ops/templates/cron/detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
apps/ops/templates/sudo/detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
apps/ops/templates/task/detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
apps/perms/templates/perms/asset_permission_asset.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -193,4 +191,4 @@
$
(
'.select2'
).
select2
();
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/perms/templates/perms/asset_permission_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -212,4 +210,4 @@
$
(
'.select2'
).
select2
();
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/perms/templates/perms/asset_permission_list.html
View file @
8a5d0b2d
{% extends '_base_list.html' %}
{% load i18n %}
{% load common_tags %}
{% block content_left_head %}
<a
href=
"{% url 'perms:asset-permission-create' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create permission" %}
</a>
{% endblock %}
...
...
apps/perms/templates/perms/asset_permission_user.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -193,4 +191,4 @@
$
(
'.select2'
).
select2
();
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/templates/_base_list.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load static %}
{% load common_tags %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
dataTables
/
dataTables
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
awesome-bootstrap-checkbox
/
awesome-bootstrap-checkbox
.
css
"
%}"
rel=
"stylesheet"
>
...
...
apps/users/models/user.py
View file @
8a5d0b2d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import
os
from
collections
import
OrderedDict
from
django.conf
import
settings
from
django.contrib.auth.hashers
import
make_password
from
django.contrib.auth.models
import
AbstractUser
from
django.core
import
signing
from
django.conf
import
settings
from
django.db
import
models
,
IntegrityError
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils
import
timezone
from
django.shortcuts
import
reverse
from
common.utils
import
signer
,
date_expired_default
from
.
import
UserGroup
from
common.utils
import
signer
,
date_expired_default
__all__
=
[
'User'
]
...
...
@@ -156,6 +157,17 @@ class User(AbstractUser):
return
True
return
False
def
avatar_url
(
self
):
if
self
.
avatar
:
return
self
.
avatar
.
url
else
:
default_dir
=
os
.
path
.
join
(
settings
.
MEDIA_ROOT
,
'avatar'
,
'default'
)
if
os
.
path
.
isdir
(
default_dir
):
default_avatar_list
=
os
.
listdir
(
default_dir
)
default_avatar
=
default_avatar_list
[
len
(
self
.
username
)
%
len
(
default_avatar_list
)]
return
os
.
path
.
join
(
settings
.
MEDIA_URL
,
'avatar'
,
'default'
,
default_avatar
)
return
'https://www.gravatar.com/avatar/c6812ab450230979465d7bf288eadce2a?s=120&d=identicon'
def
generate_reset_token
(
self
):
return
signer
.
sign_t
({
'reset'
:
self
.
id
,
'email'
:
self
.
email
},
expires_in
=
3600
)
...
...
apps/users/templates/users/user_asset_permission.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
...
...
@@ -182,4 +180,4 @@
});
})
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/users/templates/users/user_detail.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -55,7 +53,7 @@
<tbody>
<tr
class=
"no-borders-tr"
>
<td
colspan=
"2"
>
<img
src=
"{{ user
|user_
avatar_url }}"
class=
"img-circle"
width=
"64"
height=
"64"
>
<img
src=
"{{ user
.
avatar_url }}"
class=
"img-circle"
width=
"64"
height=
"64"
>
</td>
</tr>
<tr>
...
...
apps/users/templates/users/user_granted_asset.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
...
...
@@ -155,4 +153,4 @@
jumpserver
.
initDataTable
(
options2
);
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/users/templates/users/user_group_asset_permission.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
...
...
@@ -180,4 +178,4 @@
console
.
log
(
'click excel'
)
})
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/users/templates/users/user_group_granted_asset.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load bootstrap %}
{% load static %}
{% load i18n %}
...
...
@@ -155,4 +153,4 @@
jumpserver
.
initDataTable
(
options2
);
});
</script>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/users/templates/users/user_profile.html
View file @
8a5d0b2d
{% extends 'base.html' %}
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
...
...
@@ -11,7 +9,7 @@
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-
4
"
>
<div
class=
"col-sm-
6
"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<span
class=
"label label-primary"
><b>
{{ user.name }}
</b></span>
...
...
@@ -84,7 +82,7 @@
<td>
{% for group in asset_groups %}
<span
class=
"simple-tag with-link"
>
<a
href=
"
#
"
>
{{ group.name }}
</a>
<a
href=
"
{% url 'assets:asset-group-detail' group.id %}
"
>
{{ group.name }}
</a>
</span>
{% endfor %}
</td>
...
...
@@ -94,7 +92,7 @@
<td>
{% for perm in permissions %}
<span
class=
"simple-tag with-link"
>
<a
href=
"
#
"
>
{{ perm.name }}
</a>
<a
href=
"
{% url 'perms:asset-permission-detail' perm.id %}
"
>
{{ perm.name }}
</a>
</span>
{% endfor %}
</td>
...
...
@@ -105,8 +103,7 @@
</div>
</div>
</div>
<div
class=
"col-sm-4"
></div>
<div
class=
"col-sm-4"
></div>
<div
class=
"col-sm-6"
></div>
</div>
</div>
{% endblock %}
...
...
apps/users/templatetags/__init__.py
deleted
100644 → 0
View file @
f3647ea4
apps/users/templatetags/users_tags.py
deleted
100644 → 0
View file @
f3647ea4
# ~*~ coding: utf-8 ~*~
import
os
import
urllib
import
hashlib
from
django
import
template
from
django.utils
import
timezone
from
django.conf
import
settings
register
=
template
.
Library
()
@register.filter
def
join_queryset_attr
(
queryset
,
attr
,
delimiter
=
', '
):
return
delimiter
.
join
([
getattr
(
obj
,
attr
,
''
)
for
obj
in
queryset
])
@register.filter
def
is_expired
(
datetime
):
if
datetime
>
timezone
.
now
():
return
False
else
:
return
True
@register.filter
def
user_avatar_url
(
user
):
if
user
.
avatar
:
return
user
.
avatar
.
url
else
:
default_dir
=
os
.
path
.
join
(
settings
.
MEDIA_ROOT
,
'avatar'
,
'default'
)
if
os
.
path
.
isdir
(
default_dir
):
default_avatar_list
=
os
.
listdir
(
default_dir
)
default_avatar
=
default_avatar_list
[
len
(
user
.
username
)
%
len
(
default_avatar_list
)]
return
os
.
path
.
join
(
settings
.
MEDIA_URL
,
'avatar'
,
'default'
,
default_avatar
)
return
'https://www.gravatar.com/avatar/c6812ab450230979465d7bf288eadce2a?s=120&d=identicon'
apps/users/views/user.py
View file @
8a5d0b2d
...
...
@@ -324,8 +324,5 @@ class UserProfileView(LoginRequiredMixin, TemplateView):
'asset_groups'
:
asset_groups
,
'permissions'
:
permissions
}
print
assets
print
asset_groups
print
permissions
kwargs
.
update
(
context
)
return
super
(
UserProfileView
,
self
)
.
get_context_data
(
**
kwargs
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment