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
3dfb2d6a
Unverified
Commit
3dfb2d6a
authored
Nov 01, 2019
by
BaiJiangJie
Committed by
GitHub
Nov 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3405 from jumpserver/bugfix
[Update] 修改 AuthBook set_version / set_latest
parents
ebbe49fa
c25335cf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
db.py
apps/assets/backends/db.py
+0
-1
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
No files found.
apps/assets/backends/db.py
View file @
3dfb2d6a
...
...
@@ -26,5 +26,4 @@ class AuthBookBackend(BaseBackend):
}
obj
=
AuthBook
.
objects
.
create
(
**
kwargs
)
obj
.
set_auth
(
**
auth_info
)
obj
.
set_version_and_latest
()
return
obj
apps/assets/models/authbook.py
View file @
3dfb2d6a
...
...
@@ -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 @
3dfb2d6a
...
...
@@ -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 @
3dfb2d6a
...
...
@@ -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
()
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