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
d544f7f9
Commit
d544f7f9
authored
Oct 25, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 1.5.5
parents
0c1463bc
fbe4f4c1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
80 additions
and
57 deletions
+80
-57
const.py
apps/assets/const.py
+5
-5
asset.py
apps/assets/forms/asset.py
+3
-3
user.py
apps/assets/forms/user.py
+2
-2
asset.py
apps/assets/serializers/asset.py
+6
-6
system_user.py
apps/assets/serializers/system_user.py
+6
-6
const.py
apps/jumpserver/const.py
+1
-1
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+0
-0
serializers.py
apps/orgs/serializers.py
+6
-6
asset_permission.py
apps/perms/forms/asset_permission.py
+4
-4
jumpserver.js
apps/static/js/jumpserver.js
+41
-18
_foot_js.html
apps/templates/_foot_js.html
+1
-1
requirements.txt
requirements/requirements.txt
+5
-5
No files found.
apps/assets/const.py
View file @
d544f7f9
...
...
@@ -4,11 +4,11 @@
from
django.utils.translation
import
ugettext_lazy
as
_
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_HELP_TEXT
=
_
(
'
Only Numbers、letters、 chinese and characters ( {} ) are allowed
'
)
.
format
(
" "
.
join
([
'
.'
,
'_'
,
'@'
,
'-
'
]))
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_HELP_TEXT
=
_
(
'
Cannot contain special characters: [ {} ]
'
)
.
format
(
" "
.
join
([
'
/'
,
'
\\
'
]))
GENERAL_
LIMIT_SPECIAL_CHARACTERS_PATTERN
=
r"^[\._@\w-]+$
"
GENERAL_
FORBIDDEN_SPECIAL_CHARACTERS_PATTERN
=
r"[/\\]
"
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
=
\
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
=
\
_
(
"* The contains characters that are not allowed"
)
apps/assets/forms/asset.py
View file @
d544f7f9
...
...
@@ -7,7 +7,7 @@ from common.utils import get_logger
from
orgs.mixins.forms
import
OrgModelForm
from
..models
import
Asset
,
Node
from
..const
import
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_HELP_TEXT
from
..const
import
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_HELP_TEXT
logger
=
get_logger
(
__file__
)
...
...
@@ -69,7 +69,7 @@ class AssetCreateForm(OrgModelForm):
'nodes'
:
_
(
"Node"
),
}
help_texts
=
{
'hostname'
:
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_HELP_TEXT
,
'hostname'
:
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_HELP_TEXT
,
'admin_user'
:
_
(
'root or other NOPASSWD sudo privilege user existed in asset,'
'If asset is windows or other set any one, more see admin user left menu'
...
...
@@ -116,7 +116,7 @@ class AssetUpdateForm(OrgModelForm):
'nodes'
:
_
(
"Node"
),
}
help_texts
=
{
'hostname'
:
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_HELP_TEXT
,
'hostname'
:
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_HELP_TEXT
,
'admin_user'
:
_
(
'root or other NOPASSWD sudo privilege user existed in asset,'
'If asset is windows or other set any one, more see admin user left menu'
...
...
apps/assets/forms/user.py
View file @
d544f7f9
...
...
@@ -6,7 +6,7 @@ from django.utils.translation import gettext_lazy as _
from
common.utils
import
validate_ssh_private_key
,
ssh_pubkey_gen
,
get_logger
from
orgs.mixins.forms
import
OrgModelForm
from
..models
import
AdminUser
,
SystemUser
from
..const
import
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_HELP_TEXT
from
..const
import
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_HELP_TEXT
logger
=
get_logger
(
__file__
)
__all__
=
[
...
...
@@ -99,7 +99,7 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm):
}),
}
help_texts
=
{
'name'
:
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_HELP_TEXT
,
'name'
:
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_HELP_TEXT
,
'auto_push'
:
_
(
'Auto push system user to asset'
),
'priority'
:
_
(
'1-100, High level will be using login asset as default, '
'if user was granted more than 2 system user'
),
...
...
apps/assets/serializers/asset.py
View file @
d544f7f9
...
...
@@ -9,8 +9,8 @@ from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from
common.serializers
import
AdaptedBulkListSerializer
from
..models
import
Asset
,
Node
,
Label
from
..const
import
(
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_PATTERN
,
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_PATTERN
,
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
)
from
.base
import
ConnectivitySerializer
...
...
@@ -98,10 +98,10 @@ class AssetSerializer(BulkOrgResourceModelSerializer):
@staticmethod
def
validate_hostname
(
hostname
):
pattern
=
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_PATTERN
res
=
re
.
mat
ch
(
pattern
,
hostname
)
if
res
is
None
:
msg
=
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
pattern
=
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_PATTERN
res
=
re
.
sear
ch
(
pattern
,
hostname
)
if
res
is
not
None
:
msg
=
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
raise
serializers
.
ValidationError
(
msg
)
return
hostname
...
...
apps/assets/serializers/system_user.py
View file @
d544f7f9
...
...
@@ -8,8 +8,8 @@ from common.utils import ssh_pubkey_gen
from
orgs.mixins.serializers
import
BulkOrgResourceModelSerializer
from
..models
import
SystemUser
from
..const
import
(
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_PATTERN
,
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_PATTERN
,
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
)
from
.base
import
AuthSerializer
,
AuthSerializerMixin
...
...
@@ -41,10 +41,10 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
@staticmethod
def
validate_name
(
name
):
pattern
=
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_PATTERN
res
=
re
.
mat
ch
(
pattern
,
name
)
if
res
is
None
:
msg
=
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
pattern
=
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_PATTERN
res
=
re
.
sear
ch
(
pattern
,
name
)
if
res
is
not
None
:
msg
=
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
raise
serializers
.
ValidationError
(
msg
)
return
name
...
...
apps/jumpserver/const.py
View file @
d544f7f9
# -*- coding: utf-8 -*-
#
VERSION
=
'1.5.
3
'
VERSION
=
'1.5.
4
'
apps/locale/zh/LC_MESSAGES/django.mo
View file @
d544f7f9
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
d544f7f9
This diff is collapsed.
Click to expand it.
apps/orgs/serializers.py
View file @
d544f7f9
...
...
@@ -5,8 +5,8 @@ from rest_framework import serializers
from
users.models
import
User
,
UserGroup
from
assets.models
import
Asset
,
Domain
,
AdminUser
,
SystemUser
,
Label
from
assets.const
import
(
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_PATTERN
,
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_PATTERN
,
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
)
from
perms.models
import
AssetPermission
from
common.serializers
import
AdaptedBulkListSerializer
...
...
@@ -24,10 +24,10 @@ class OrgSerializer(ModelSerializer):
@staticmethod
def
validate_name
(
name
):
pattern
=
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_PATTERN
res
=
re
.
mat
ch
(
pattern
,
name
)
if
res
is
None
:
msg
=
GENERAL_
LIMIT
_SPECIAL_CHARACTERS_ERROR_MSG
pattern
=
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_PATTERN
res
=
re
.
sear
ch
(
pattern
,
name
)
if
res
is
not
None
:
msg
=
GENERAL_
FORBIDDEN
_SPECIAL_CHARACTERS_ERROR_MSG
raise
serializers
.
ValidationError
(
msg
)
return
name
...
...
apps/perms/forms/asset_permission.py
View file @
d544f7f9
...
...
@@ -20,6 +20,10 @@ class ActionField(forms.MultipleChoiceField):
kwargs
[
'initial'
]
=
Action
.
ALL
kwargs
[
'label'
]
=
_
(
"Action"
)
kwargs
[
'widget'
]
=
forms
.
CheckboxSelectMultiple
()
kwargs
[
'help_text'
]
=
_
(
'Tips: The RDP protocol does not support separate controls '
'for uploading or downloading files'
)
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
to_python
(
self
,
value
):
...
...
@@ -89,10 +93,6 @@ class AssetPermissionForm(OrgModelForm):
labels
=
{
'nodes'
:
_
(
"Node"
),
}
help_texts
=
{
'actions'
:
_
(
'Tips: The RDP protocol does not support separate '
'controls for uploading or downloading files'
)
}
def
clean_user_groups
(
self
):
users
=
self
.
cleaned_data
.
get
(
'users'
)
...
...
apps/static/js/jumpserver.js
View file @
d544f7f9
...
...
@@ -414,6 +414,44 @@ function makeLabel(data) {
return
"<label class='detail-key'><b>"
+
data
[
0
]
+
": </b></label>"
+
data
[
1
]
+
"</br>"
}
function
parseTableFilter
(
value
)
{
var
cleanValues
=
[];
var
valuesArray
=
value
.
split
(
':'
);
for
(
var
i
=
0
;
i
<
valuesArray
.
length
;
i
++
)
{
var
v
=
valuesArray
[
i
].
trim
();
if
(
!
v
)
{
continue
}
// 如果是最后一个元素,直接push,不需要再处理了, 因为最后一个肯定不是key
if
(
i
===
valuesArray
.
length
-
1
)
{
cleanValues
.
push
(
v
);
continue
}
v
=
v
.
split
(
' '
);
// 如果长度是1,直接push上
// 如果长度不是1,根据空格分隔后,最后面的是key
if
(
v
.
length
===
1
)
{
cleanValues
.
push
(
v
[
0
]);
}
else
{
var
leaveData
=
v
.
slice
(
0
,
-
1
).
join
(
' '
).
trim
();
cleanValues
.
push
(
leaveData
);
cleanValues
.
push
(
v
.
slice
(
-
1
)[
0
]);
}
}
var
filter
=
{};
var
key
=
''
;
for
(
i
=
0
;
i
<
cleanValues
.
length
;
i
++
)
{
if
(
i
%
2
===
0
)
{
key
=
cleanValues
[
i
]
}
else
{
value
=
cleanValues
[
i
];
filter
[
key
]
=
value
}
}
console
.
log
(
filter
);
return
filter
;
}
var
jumpserver
=
{};
jumpserver
.
checked
=
false
;
...
...
@@ -611,24 +649,9 @@ jumpserver.initServerSideDataTable = function (options) {
delete
data
.
start
;
}
if
(
data
.
search
!==
null
)
{
var
search_val
=
data
.
search
.
value
;
var
search_list
=
search_val
.
split
(
" "
);
var
search_attr
=
{};
var
search_raw
=
[];
search_list
.
map
(
function
(
val
,
index
)
{
var
kv
=
val
.
split
(
":"
);
if
(
kv
.
length
===
2
)
{
var
value
=
kv
[
1
];
var
key
=
kv
[
0
].
trim
();
value
=
value
.
replace
(
"+"
,
" "
).
trim
();
search_attr
[
key
]
=
value
}
else
{
search_raw
.
push
(
kv
)
}
});
data
.
search
=
search_raw
.
join
(
""
);
$
.
each
(
search_attr
,
function
(
k
,
v
)
{
var
searchValue
=
data
.
search
.
value
;
var
searchFilter
=
parseTableFilter
(
searchValue
);
$
.
each
(
searchFilter
,
function
(
k
,
v
)
{
data
[
k
]
=
v
})
}
...
...
apps/templates/_foot_js.html
View file @
d544f7f9
...
...
@@ -7,7 +7,7 @@
<script
src=
"{% static "
js
/
plugins
/
toastr
/
toastr
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
inspinia
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% url 'javascript-catalog' %}"
></script>
<script
src=
"{% static "
js
/
jumpserver
.
js
"
%}?
v=
4
"
></script>
<script
src=
"{% static "
js
/
jumpserver
.
js
"
%}?
v=
5
"
></script>
<script>
activeNav
(
"{{ FORCE_SCRIPT_NAME }}"
);
$
(
document
).
ready
(
function
(){
...
...
requirements/requirements.txt
View file @
d544f7f9
amqp==2.1.4
ansible==2.8.
0
ansible==2.8.
2
asn1crypto==0.24.0
bcrypt==3.1.4
billiard==3.5.0.3
...
...
@@ -14,7 +14,7 @@ coreapi==2.3.3
coreschema==0.0.4
cryptography==2.3.1
decorator==4.1.2
Django==2.1.
7
Django==2.1.
11
django-auth-ldap==1.7.0
django-bootstrap3==9.1.0
django-celery-beat==1.4.0
...
...
@@ -27,7 +27,7 @@ django-simple-captcha==0.5.6
djangorestframework==3.9.4
djangorestframework-bulk==0.2.1
docutils==0.14
ecdsa==0.13
ecdsa==0.13
.3
enum-compat==0.0.2
ephem==3.7.6.0
eventlet==0.24.1
...
...
@@ -47,7 +47,7 @@ olefile==0.44
openapi-codec==1.3.2
paramiko==2.4.2
passlib==1.7.1
Pillow==
4.3
.0
Pillow==
6.2
.0
pyasn1==0.4.2
pycparser==2.19
pycrypto==2.6.1
...
...
@@ -68,7 +68,7 @@ uritemplate==3.0.0
urllib3==1.25.2
vine==1.1.4
drf-yasg==1.9.1
Werkzeug==0.1
4.1
Werkzeug==0.1
5.3
drf-nested-routers==0.91
aliyun-python-sdk-core-v3==2.9.1
aliyun-python-sdk-ecs==4.10.1
...
...
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