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
fa02e3fb
Commit
fa02e3fb
authored
Nov 06, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
[Update] Merge with bugfix
parents
6fbc4ce4
ed5a5704
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
64 additions
and
17 deletions
+64
-17
authbook.py
apps/assets/models/authbook.py
+0
-4
asset_user.py
apps/assets/serializers/asset_user.py
+1
-1
signals_handler.py
apps/assets/signals_handler.py
+7
-1
_asset_list_modal.html
apps/assets/templates/assets/_asset_list_modal.html
+1
-1
_node_tree.html
apps/assets/templates/assets/_node_tree.html
+3
-4
conf.py
apps/jumpserver/conf.py
+2
-1
adhoc.py
apps/ops/models/adhoc.py
+1
-0
api.py
apps/settings/api.py
+22
-3
serializers.py
apps/settings/serializers.py
+3
-0
api_urls.py
apps/settings/urls/api_urls.py
+1
-0
forms.py
apps/users/forms.py
+21
-1
group.py
apps/users/serializers/group.py
+1
-0
user.py
apps/users/serializers/user.py
+0
-1
_user.html
apps/users/templates/users/_user.html
+1
-0
No files found.
apps/assets/models/authbook.py
View file @
fa02e3fb
...
...
@@ -60,10 +60,6 @@ class AuthBook(AssetUser):
self
.
version
=
1
self
.
save
()
def
set_version_and_latest
(
self
):
self
.
set_version
()
self
.
set_to_latest
()
def
get_related_assets
(
self
):
return
[
self
.
asset
]
...
...
apps/assets/serializers/asset_user.py
View file @
fa02e3fb
...
...
@@ -53,7 +53,7 @@ class AssetUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
if
not
validated_data
.
get
(
"name"
)
and
validated_data
.
get
(
"username"
):
validated_data
[
"name"
]
=
validated_data
[
"username"
]
instance
=
AssetUserManager
.
create
(
**
validated_data
)
instance
.
set_
version_and
_latest
()
instance
.
set_
to
_latest
()
return
instance
...
...
apps/assets/signals_handler.py
View file @
fa02e3fb
...
...
@@ -9,7 +9,7 @@ from django.dispatch import receiver
from
common.utils
import
get_logger
,
timeit
from
common.decorator
import
on_transaction_commit
from
.models
import
Asset
,
SystemUser
,
Node
from
.models
import
Asset
,
SystemUser
,
Node
,
AuthBook
from
.tasks
import
(
update_assets_hardware_info_util
,
test_asset_connectivity_util
,
...
...
@@ -189,3 +189,9 @@ def on_asset_nodes_remove(sender, instance=None, action='', model=None,
def
on_node_update_or_created
(
sender
,
**
kwargs
):
# 刷新节点
Node
.
refresh_nodes
()
@receiver
(
post_save
,
sender
=
AuthBook
)
def
on_authbook_created
(
sender
,
instance
=
None
,
created
=
True
,
**
kwargs
):
if
created
and
instance
:
instance
.
set_version
()
apps/assets/templates/assets/_asset_list_modal.html
View file @
fa02e3fb
...
...
@@ -25,7 +25,7 @@
<div
class=
"wrapper wrapper-content"
>
<div
class=
"row"
>
<div
class=
"col-lg-3"
id=
"split-left"
style=
"padding-left: 3px"
>
<div
class=
"col-lg-3"
id=
"split-left"
style=
"padding-left: 3px
;overflow: auto;max-height: 500px
"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content mailbox-content"
style=
"padding-top: 0;padding-left: 1px"
>
<div
class=
"file-manager "
>
...
...
apps/assets/templates/assets/_node_tree.html
View file @
fa02e3fb
...
...
@@ -32,8 +32,7 @@
}
</style>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox treebox float-e-margins"
style=
"overflow:auto;"
>
<div
class=
"ibox-content mailbox-content"
style=
"padding-top: 0;padding-left: 1px"
>
<div
class=
"file-manager"
id=
"tree-node-id"
>
<div
id=
"{% block treeID %}nodeTree{% endblock %}"
class=
"ztree"
>
...
...
@@ -306,6 +305,7 @@ function defaultCallback(action) {
$
(
document
).
ready
(
function
()
{
$
(
'.treebox'
).
css
(
'height'
,
window
.
innerHeight
-
180
);
})
.
on
(
'click'
,
'.btn-show-current-asset'
,
function
(){
hideRMenu
();
...
...
@@ -322,4 +322,4 @@ $(document).ready(function () {
location
.
reload
();
})
</script>
\ No newline at end of file
</script>
apps/jumpserver/conf.py
View file @
fa02e3fb
...
...
@@ -396,7 +396,8 @@ defaults = {
'DEFAULT_ORG_SHOW_ALL_USERS'
:
True
,
'PERIOD_TASK_ENABLE'
:
True
,
'FORCE_SCRIPT_NAME'
:
''
,
'LOGIN_CONFIRM_ENABLE'
:
False
'LOGIN_CONFIRM_ENABLE'
:
False
,
'WINDOWS_SKIP_ALL_MANUAL_PASSWORD'
:
False
,
}
...
...
apps/ops/models/adhoc.py
View file @
fa02e3fb
...
...
@@ -242,6 +242,7 @@ class AdHoc(models.Model):
except
AttributeError
:
hid
=
str
(
uuid
.
uuid4
())
history
=
AdHocRunHistory
(
id
=
hid
,
adhoc
=
self
,
task
=
self
.
task
)
history
.
save
()
time_start
=
time
.
time
()
date_start
=
timezone
.
now
()
is_success
=
False
...
...
apps/settings/api.py
View file @
fa02e3fb
...
...
@@ -12,11 +12,14 @@ from django.conf import settings
from
django.core.mail
import
send_mail
from
django.utils.translation
import
ugettext_lazy
as
_
from
.models
import
Setting
from
.utils
import
LDAPUtil
from
common.permissions
import
IsOrgAdmin
,
IsSuperUser
from
common.utils
import
get_logger
from
.serializers
import
MailTestSerializer
,
LDAPTestSerializer
,
LDAPUserSerializer
from
.models
import
Setting
from
.utils
import
LDAPUtil
from
.serializers
import
(
MailTestSerializer
,
LDAPTestSerializer
,
LDAPUserSerializer
,
PublicSettingSerializer
,
)
logger
=
get_logger
(
__file__
)
...
...
@@ -245,3 +248,19 @@ class CommandStorageDeleteAPI(APIView):
storage_name
=
str
(
request
.
data
.
get
(
'name'
))
Setting
.
delete_storage
(
'TERMINAL_COMMAND_STORAGE'
,
storage_name
)
return
Response
({
"msg"
:
_
(
'Delete succeed'
)},
status
=
200
)
class
PublicSettingApi
(
generics
.
RetrieveAPIView
):
permission_classes
=
()
serializer_class
=
PublicSettingSerializer
def
get_object
(
self
):
c
=
settings
.
CONFIG
instance
=
{
"data"
:
{
"WINDOWS_SKIP_ALL_MANUAL_PASSWORD"
:
c
.
WINDOWS_SKIP_ALL_MANUAL_PASSWORD
}
}
return
instance
apps/settings/serializers.py
View file @
fa02e3fb
...
...
@@ -28,3 +28,6 @@ class LDAPUserSerializer(serializers.Serializer):
email
=
serializers
.
CharField
()
existing
=
serializers
.
BooleanField
(
read_only
=
True
)
class
PublicSettingSerializer
(
serializers
.
Serializer
):
data
=
serializers
.
DictField
(
read_only
=
True
)
apps/settings/urls/api_urls.py
View file @
fa02e3fb
...
...
@@ -15,4 +15,5 @@ urlpatterns = [
path
(
'terminal/replay-storage/delete/'
,
api
.
ReplayStorageDeleteAPI
.
as_view
(),
name
=
'replay-storage-delete'
),
path
(
'terminal/command-storage/create/'
,
api
.
CommandStorageCreateAPI
.
as_view
(),
name
=
'command-storage-create'
),
path
(
'terminal/command-storage/delete/'
,
api
.
CommandStorageDeleteAPI
.
as_view
(),
name
=
'command-storage-delete'
),
path
(
'public/'
,
api
.
PublicSettingApi
.
as_view
(),
name
=
'public-setting'
),
]
apps/users/forms.py
View file @
fa02e3fb
...
...
@@ -2,6 +2,7 @@
from
django
import
forms
from
django.utils.translation
import
gettext_lazy
as
_
from
django.conf
import
settings
from
common.utils
import
validate_ssh_public_key
from
orgs.mixins.forms
import
OrgModelForm
...
...
@@ -21,6 +22,20 @@ class UserCheckOtpCodeForm(forms.Form):
otp_code
=
forms
.
CharField
(
label
=
_
(
'MFA code'
),
max_length
=
6
)
def
get_source_choices
():
choices_all
=
dict
(
User
.
SOURCE_CHOICES
)
choices
=
[
(
User
.
SOURCE_LOCAL
,
choices_all
[
User
.
SOURCE_LOCAL
]),
]
if
settings
.
AUTH_LDAP
:
choices
.
append
((
User
.
SOURCE_LDAP
,
choices_all
[
User
.
SOURCE_LDAP
]))
if
settings
.
AUTH_OPENID
:
choices
.
append
((
User
.
SOURCE_OPENID
,
choices_all
[
User
.
SOURCE_OPENID
]))
if
settings
.
AUTH_RADIUS
:
choices
.
append
((
User
.
SOURCE_RADIUS
,
choices_all
[
User
.
SOURCE_RADIUS
]))
return
choices
class
UserCreateUpdateFormMixin
(
OrgModelForm
):
role_choices
=
((
i
,
n
)
for
i
,
n
in
User
.
ROLE_CHOICES
if
i
!=
User
.
ROLE_APP
)
password
=
forms
.
CharField
(
...
...
@@ -31,6 +46,10 @@ class UserCreateUpdateFormMixin(OrgModelForm):
choices
=
role_choices
,
required
=
True
,
initial
=
User
.
ROLE_USER
,
label
=
_
(
"Role"
)
)
source
=
forms
.
ChoiceField
(
choices
=
get_source_choices
,
required
=
True
,
initial
=
User
.
SOURCE_LOCAL
,
label
=
_
(
"Source"
)
)
public_key
=
forms
.
CharField
(
label
=
_
(
'ssh public key'
),
max_length
=
5000
,
required
=
False
,
widget
=
forms
.
Textarea
(
attrs
=
{
'placeholder'
:
_
(
'ssh-rsa AAAA...'
)}),
...
...
@@ -41,7 +60,8 @@ class UserCreateUpdateFormMixin(OrgModelForm):
model
=
User
fields
=
[
'username'
,
'name'
,
'email'
,
'groups'
,
'wechat'
,
'phone'
,
'role'
,
'date_expired'
,
'comment'
,
'otp_level'
'source'
,
'phone'
,
'role'
,
'date_expired'
,
'comment'
,
'otp_level'
]
widgets
=
{
'otp_level'
:
forms
.
RadioSelect
(),
...
...
apps/users/serializers/group.py
View file @
fa02e3fb
...
...
@@ -66,3 +66,4 @@ class UserGroupUpdateMemberSerializer(serializers.ModelSerializer):
def
set_fields_queryset
(
self
):
users_field
=
self
.
fields
[
'users'
]
users_field
.
child_relation
.
queryset
=
utils
.
get_current_org_members
()
apps/users/serializers/user.py
View file @
fa02e3fb
...
...
@@ -43,7 +43,6 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
'is_valid'
:
{
'label'
:
_
(
'Is valid'
)},
'is_expired'
:
{
'label'
:
_
(
'Is expired'
)},
'avatar_url'
:
{
'label'
:
_
(
'Avatar url'
)},
'source'
:
{
'read_only'
:
True
},
'created_by'
:
{
'read_only'
:
True
,
'allow_blank'
:
True
},
'can_update'
:
{
'read_only'
:
True
},
'can_delete'
:
{
'read_only'
:
True
},
...
...
apps/users/templates/users/_user.html
View file @
fa02e3fb
...
...
@@ -21,6 +21,7 @@
<h3>
{% trans 'Auth' %}
</h3>
{% block password %}{% endblock %}
{% bootstrap_field form.otp_level layout="horizontal" %}
{% bootstrap_field form.source layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Security and Role' %}
</h3>
...
...
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