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
a2f8f433
Commit
a2f8f433
authored
Oct 22, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改查看auth info可以关闭mfa
parent
6ebe8e16
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
4 deletions
+22
-4
asset_user.py
apps/assets/api/asset_user.py
+13
-2
manager.py
apps/assets/backends/manager.py
+2
-2
_asset_user_list.html
apps/assets/templates/assets/_asset_user_list.html
+5
-0
conf.py
apps/jumpserver/conf.py
+1
-0
context_processor.py
apps/jumpserver/context_processor.py
+1
-0
No files found.
apps/assets/api/asset_user.py
View file @
a2f8f433
...
...
@@ -7,6 +7,7 @@ from rest_framework import filters
from
rest_framework_bulk
import
BulkModelViewSet
from
django.shortcuts
import
get_object_or_404
from
django.http
import
Http404
from
django.conf
import
settings
from
common.permissions
import
IsOrgAdminOrAppUser
,
NeedMFAVerify
from
common.utils
import
get_object_or_none
,
get_logger
...
...
@@ -110,12 +111,22 @@ class AssetUserViewSet(CommonApiMixin, BulkModelViewSet):
class
AssetUserExportViewSet
(
AssetUserViewSet
):
serializer_class
=
serializers
.
AssetUserExportSerializer
http_method_names
=
[
'get'
]
permission_classes
=
[
IsOrgAdminOrAppUser
,
NeedMFAVerify
]
permission_classes
=
[
IsOrgAdminOrAppUser
]
def
get_permissions
(
self
):
if
settings
.
CONFIG
.
SECURITY_VIEW_AUTH_NEED_MFA
:
self
.
permission_classes
=
[
IsOrgAdminOrAppUser
,
NeedMFAVerify
]
return
super
()
.
get_permissions
()
class
AssetUserAuthInfoApi
(
generics
.
RetrieveAPIView
):
serializer_class
=
serializers
.
AssetUserAuthInfoSerializer
permission_classes
=
[
IsOrgAdminOrAppUser
,
NeedMFAVerify
]
permission_classes
=
[
IsOrgAdminOrAppUser
]
def
get_permissions
(
self
):
if
settings
.
CONFIG
.
SECURITY_VIEW_AUTH_NEED_MFA
:
self
.
permission_classes
=
[
IsOrgAdminOrAppUser
,
NeedMFAVerify
]
return
super
()
.
get_permissions
()
def
get_object
(
self
):
query_params
=
self
.
request
.
query_params
...
...
apps/assets/backends/manager.py
View file @
a2f8f433
...
...
@@ -41,8 +41,8 @@ class AssetUserManager:
instances_map
=
{}
instances
=
[]
for
name
,
backend
in
self
.
backends
:
if
name
!=
"db"
and
self
.
_prefer
!=
name
:
continue
# if name != "db"
:
#
continue
_instances
=
backend
.
filter
(
username
=
username
,
assets
=
assets
,
latest
=
latest
,
prefer
=
self
.
_prefer
,
prefer_id
=
prefer_id
,
...
...
apps/assets/templates/assets/_asset_user_list.html
View file @
a2f8f433
...
...
@@ -40,6 +40,7 @@ var prefer = null;
var
lastMFATime
=
"{{ request.session.MFA_VERIFY_TIME }}"
;
var
testDatetime
=
"{% trans 'Test datetime: ' %}"
;
var
mfaVerifyTTL
=
"{{ SECURITY_MFA_VERIFY_TTL }}"
;
var
mfaNeedCheck
=
"{{ SECURITY_VIEW_AUTH_NEED_MFA }}"
;
function
initAssetUserTable
()
{
var
options
=
{
...
...
@@ -112,6 +113,10 @@ $(document).ready(function(){
authAssetId
=
$
(
this
).
data
(
"asset"
)
;
authHostname
=
$
(
this
).
data
(
"hostname"
);
authUsername
=
$
(
this
).
data
(
'user'
);
if
(
mfaNeedCheck
!==
'True'
)
{
$
(
"#asset_user_auth_view"
).
modal
(
'show'
);
return
}
var
now
=
new
Date
();
var
nowTime
=
now
.
getTime
()
/
1000
;
if
(
!
lastMFATime
||
nowTime
-
lastMFATime
>
mfaVerifyTTL
)
{
...
...
apps/jumpserver/conf.py
View file @
a2f8f433
...
...
@@ -361,6 +361,7 @@ defaults = {
'TERMINAL_COMMAND_STORAGE'
:
{},
'SECURITY_MFA_AUTH'
:
False
,
'SECURITY_SERVICE_ACCOUNT_REGISTRATION'
:
True
,
'SECURITY_VIEW_AUTH_NEED_MFA'
:
True
,
'SECURITY_LOGIN_LIMIT_COUNT'
:
7
,
'SECURITY_LOGIN_LIMIT_TIME'
:
30
,
'SECURITY_MAX_IDLE_TIME'
:
30
,
...
...
apps/jumpserver/context_processor.py
View file @
a2f8f433
...
...
@@ -18,6 +18,7 @@ def jumpserver_processor(request):
'COPYRIGHT'
:
'FIT2CLOUD 飞致云'
+
' © 2014-2019'
,
'SECURITY_COMMAND_EXECUTION'
:
settings
.
SECURITY_COMMAND_EXECUTION
,
'SECURITY_MFA_VERIFY_TTL'
:
settings
.
SECURITY_MFA_VERIFY_TTL
,
'SECURITY_VIEW_AUTH_NEED_MFA'
:
settings
.
CONFIG
.
SECURITY_VIEW_AUTH_NEED_MFA
,
}
return
context
...
...
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