Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
fe4363b8
Commit
fe4363b8
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Don't display too much detail when a user has no right to see a profile
parent
6e80016b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!138
Permissions PC Kfet
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/member/tables.py
+16
-0
16 additions, 0 deletions
apps/member/tables.py
apps/member/templates/member/includes/profile_info.html
+16
-14
16 additions, 14 deletions
apps/member/templates/member/includes/profile_info.html
with
32 additions
and
14 deletions
apps/member/tables.py
+
16
−
0
View file @
fe4363b8
...
...
@@ -43,8 +43,24 @@ class UserTable(tables.Table):
section
=
tables
.
Column
(
accessor
=
'
profile__section
'
)
# Override the column to let replace the URL
email
=
tables
.
EmailColumn
(
linkify
=
lambda
record
:
"
mailto:{}
"
.
format
(
record
.
email
))
balance
=
tables
.
Column
(
accessor
=
'
note__balance
'
,
verbose_name
=
_
(
"
Balance
"
))
def
render_email
(
self
,
record
,
value
):
# Replace the email by a dash if the user can't see the profile detail
# Replace also the URL
if
not
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
member.view_profile
"
,
record
.
profile
):
value
=
"
—
"
record
.
email
=
value
return
value
def
render_section
(
self
,
record
,
value
):
return
value
\
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
member.view_profile
"
,
record
.
profile
)
\
else
"
—
"
def
render_balance
(
self
,
record
,
value
):
return
pretty_money
(
value
)
\
if
PermissionBackend
.
check_perm
(
get_current_authenticated_user
(),
"
note.view_note
"
,
record
.
note
)
else
"
—
"
...
...
This diff is collapsed.
Click to expand it.
apps/member/templates/member/includes/profile_info.html
+
16
−
14
View file @
fe4363b8
...
...
@@ -25,25 +25,27 @@
</a>
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'section'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.profile.section }}
</dd>
{% if "member.view_profile"|has_perm:user_object.profile %}
<dt
class=
"col-xl-6"
>
{% trans 'section'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.profile.section }}
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'email'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
><a
href=
"mailto:{{ user_object.email }}"
>
{{ user_object.email }}
</a></dd>
<dt
class=
"col-xl-6"
>
{% trans 'email'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
><a
href=
"mailto:{{ user_object.email }}"
>
{{ user_object.email }}
</a></dd>
<dt
class=
"col-xl-6"
>
{% trans 'phone number'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
><a
href=
"tel:{{ user_object.profile.phone_number }}"
>
{{ user_object.profile.phone_number }}
</a>
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'phone number'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
><a
href=
"tel:{{ user_object.profile.phone_number }}"
>
{{ user_object.profile.phone_number }}
</a>
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'address'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.profile.address }}
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'address'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.profile.address }}
</dd>
{% if user_object.note and "note.view_note"|has_perm:user_object.note %}
<dt
class=
"col-xl-6"
>
{% trans 'balance'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.note.balance | pretty_money }}
</dd>
{% if user_object.note and "note.view_note"|has_perm:user_object.note %}
<dt
class=
"col-xl-6"
>
{% trans 'balance'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.note.balance | pretty_money }}
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'paid'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.profile.paid|yesno }}
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'paid'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{ user_object.profile.paid|yesno }}
</dd>
{% endif %}
{% endif %}
</dl>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment