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
4dc5d7d7
Commit
4dc5d7d7
authored
Nov 19, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 换做lazyproperty
parent
3fc30aa9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
user.py
apps/users/models/user.py
+2
-3
user_profile.html
apps/users/templates/users/user_profile.html
+8
-8
No files found.
apps/users/models/user.py
View file @
4dc5d7d7
...
@@ -10,7 +10,6 @@ from django.conf import settings
...
@@ -10,7 +10,6 @@ from django.conf import settings
from
django.contrib.auth.hashers
import
make_password
from
django.contrib.auth.hashers
import
make_password
from
django.contrib.auth.models
import
AbstractUser
from
django.contrib.auth.models
import
AbstractUser
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.db
import
models
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
...
@@ -18,7 +17,7 @@ from django.utils import timezone
...
@@ -18,7 +17,7 @@ from django.utils import timezone
from
django.shortcuts
import
reverse
from
django.shortcuts
import
reverse
from
orgs.utils
import
current_org
from
orgs.utils
import
current_org
from
common.utils
import
get_signer
,
date_expired_default
,
get_logger
from
common.utils
import
get_signer
,
date_expired_default
,
get_logger
,
lazyproperty
from
common
import
fields
from
common
import
fields
...
@@ -217,7 +216,7 @@ class RoleMixin:
...
@@ -217,7 +216,7 @@ class RoleMixin:
from
orgs.models
import
Organization
from
orgs.models
import
Organization
return
Organization
.
get_user_admin_or_audit_orgs
(
self
)
return
Organization
.
get_user_admin_or_audit_orgs
(
self
)
@property
@
lazy
property
def
is_org_admin
(
self
):
def
is_org_admin
(
self
):
if
self
.
is_superuser
or
self
.
related_admin_orgs
.
exists
():
if
self
.
is_superuser
or
self
.
related_admin_orgs
.
exists
():
return
True
return
True
...
...
apps/users/templates/users/user_profile.html
View file @
4dc5d7d7
...
@@ -173,22 +173,22 @@
...
@@ -173,22 +173,22 @@
</span>
</span>
</td>
</td>
</tr>
</tr>
{% if request.user.
can_update_passwor
d %}
{% if request.user.
mfa_enable
d %}
<tr
class=
"no-borders"
>
<tr>
<td>
{% trans 'Update
password
' %}:
</td>
<td>
{% trans 'Update
MFA
' %}:
</td>
<td>
<td>
<span
class=
"pull-right"
>
<span
class=
"pull-right"
>
<a
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
href=
"{% url 'users:user-
password
-update' %}"
>
{% trans 'Update' %}
</a>
<a
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
href=
"{% url 'users:user-
otp
-update' %}"
>
{% trans 'Update' %}
</a>
</span>
</span>
</td>
</td>
</tr>
</tr>
{% endif %}
{% endif %}
{% if request.user.
mfa_enable
d %}
{% if request.user.
can_update_passwor
d %}
<tr>
<tr
class=
"no-borders"
>
<td>
{% trans 'Update
MFA
' %}:
</td>
<td>
{% trans 'Update
password
' %}:
</td>
<td>
<td>
<span
class=
"pull-right"
>
<span
class=
"pull-right"
>
<a
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
href=
"{% url 'users:user-
otp
-update' %}"
>
{% trans 'Update' %}
</a>
<a
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
href=
"{% url 'users:user-
password
-update' %}"
>
{% trans 'Update' %}
</a>
</span>
</span>
</td>
</td>
</tr>
</tr>
...
...
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