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
873d9098
Unverified
Commit
873d9098
authored
Dec 03, 2019
by
BaiJiangJie
Committed by
GitHub
Dec 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3449 from jumpserver/user_detail_template
[Update] 修改用户详情页中用户组标签不显示的问题
parents
45444149
a92aec27
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
38 deletions
+48
-38
models.py
apps/orgs/models.py
+5
-0
user.py
apps/users/models/user.py
+4
-0
user_detail.html
apps/users/templates/users/user_detail.html
+39
-38
No files found.
apps/orgs/models.py
View file @
873d9098
...
...
@@ -118,6 +118,11 @@ class Organization(models.Model):
return
True
return
False
def
can_user_by
(
self
,
user
):
if
self
.
get_org_users
()
.
filter
(
id
=
user
.
id
):
return
True
return
False
def
is_real
(
self
):
return
self
.
id
not
in
(
self
.
DEFAULT_NAME
,
self
.
ROOT_ID
,
self
.
SYSTEM_ID
)
...
...
apps/users/models/user.py
View file @
873d9098
...
...
@@ -217,6 +217,10 @@ class RoleMixin:
def
can_audit_current_org
(
self
):
return
current_org
.
can_audit_by
(
self
)
@property
def
can_user_current_org
(
self
):
return
current_org
.
can_user_by
(
self
)
@property
def
can_admin_or_audit_current_org
(
self
):
return
self
.
can_admin_current_org
or
self
.
can_audit_current_org
...
...
apps/users/templates/users/user_detail.html
View file @
873d9098
...
...
@@ -211,46 +211,47 @@
</table>
</div>
</div>
{% if request.user.can_admin_current_org %}
{% if user_object.can_user_current_org or user_object.can_admin_current_org %}
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'User group' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table group_edit"
>
<tbody>
<form>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<select
data-placeholder=
"{% trans 'Join user groups' %}"
id=
"groups_selected"
class=
"select2"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
{% for group in groups %}
<option
value=
"{{ group.id }}"
id=
"opt_{{ group.id }}"
>
{{ group.name }}
</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<button
type=
"button"
class=
"btn btn-info btn-small"
id=
"btn_join_group"
>
{% trans 'Join' %}
</button>
</td>
</tr>
</form>
{% if user_object.is_current_org_admin %}
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
{% trans 'User group' %}
{% for group in user_object.groups.all %}
<tr>
<td
>
<b
class=
"bdg_group"
data-gid=
{{
group
.
id
}}
>
{{ group.name }}
</b>
</td>
<td>
<button
class=
"btn btn-danger pull-right btn-xs btn_leave_group"
type=
"button"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div
class=
"panel-body"
>
<table
class=
"table group_edit"
>
<tbody>
<form>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<select
data-placeholder=
"{% trans 'Join user groups' %}"
id=
"groups_selected"
class=
"select2"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
{% for group in groups %}
<option
value=
"{{ group.id }}"
id=
"opt_{{ group.id }}"
>
{{ group.name }}
</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<button
type=
"button"
class=
"btn btn-info btn-small"
id=
"btn_join_group"
>
{% trans 'Join' %}
</button>
</td>
</tr>
</form>
{% for group in user_object.groups.all %}
<tr>
<td
>
<b
class=
"bdg_group"
data-gid=
{{
group
.
id
}}
>
{{ group.name }}
</b>
</td>
<td>
<button
class=
"btn btn-danger pull-right btn-xs btn_leave_group"
type=
"button"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
...
...
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