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
051591cb
Commit
051591cb
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
Don't see user detail in update form
parent
0e7390b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!138
Permissions PC Kfet
Pipeline
#8796
passed with warnings with stages
in 14 minutes and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/member/views.py
+5
-4
5 additions, 4 deletions
apps/member/views.py
apps/permission/views.py
+3
-1
3 additions, 1 deletion
apps/permission/views.py
with
8 additions
and
5 deletions
apps/member/views.py
+
5
−
4
View file @
051591cb
...
...
@@ -70,10 +70,11 @@ class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
form
.
fields
[
'
email
'
].
required
=
True
form
.
fields
[
'
email
'
].
help_text
=
_
(
"
This address must be valid.
"
)
context
[
'
profile_form
'
]
=
self
.
profile_form
(
instance
=
context
[
'
user_object
'
].
profile
,
data
=
self
.
request
.
POST
if
self
.
request
.
POST
else
None
)
if
not
self
.
object
.
profile
.
report_frequency
:
del
context
[
'
profile_form
'
].
fields
[
"
last_report
"
]
if
PermissionBackend
.
check_perm
(
self
.
request
.
user
,
"
member.change_profile
"
,
context
[
'
user_object
'
].
profile
):
context
[
'
profile_form
'
]
=
self
.
profile_form
(
instance
=
context
[
'
user_object
'
].
profile
,
data
=
self
.
request
.
POST
if
self
.
request
.
POST
else
None
)
if
not
self
.
object
.
profile
.
report_frequency
:
del
context
[
'
profile_form
'
].
fields
[
"
last_report
"
]
return
context
...
...
This diff is collapsed.
Click to expand it.
apps/permission/views.py
+
3
−
1
View file @
051591cb
...
...
@@ -51,8 +51,10 @@ class ProtectQuerysetMixin:
# No worry if the user change the hidden fields: a 403 error will be performed if the user tries to make
# a custom request.
# We could also delete the field, but some views might be affected.
meta
=
form
.
instance
.
_meta
for
key
in
form
.
base_fields
:
if
not
PermissionBackend
.
check_perm
(
self
.
request
.
user
,
"
wei.change_weiregistration_
"
+
key
,
self
.
object
):
if
not
PermissionBackend
.
check_perm
(
self
.
request
.
user
,
f
"
{
meta
.
app_label
}
.change_
{
meta
.
model_name
}
_
"
+
key
,
self
.
object
):
form
.
fields
[
key
].
widget
=
HiddenInput
()
return
form
...
...
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