Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VILLASweb-backend-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASweb-backend-node
Commits
1b716956
Commit
1b716956
authored
8 years ago
by
Ricardo Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
removed missing user.adminLevel property
parent
d91bde59
Branches
Branches containing commit
No related tags found
1 merge request
!2
Users update
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
routes/users.js
+3
-4
3 additions, 4 deletions
routes/users.js
with
3 additions
and
4 deletions
routes/users.js
+
3
−
4
View file @
1b716956
...
...
@@ -72,23 +72,22 @@ router.put('/users/:id', auth.validateRole('user', 'update'), function(req, res)
}
// if user is not an admin, only allow some changes on own data
// update all properties
if
(
req
.
decoded
.
_doc
.
adminLevel
>=
1
)
{
if
(
req
.
decoded
.
_doc
.
role
===
'
admin
'
)
{
for
(
property
in
req
.
body
.
user
)
{
user
[
property
]
=
req
.
body
.
user
[
property
];
}
}
else
if
(
req
.
decoded
.
_doc
.
_id
===
req
.
params
.
id
)
{
// only copy the allowed properties since the user is not an admin
for
(
property
in
req
.
body
.
user
)
{
if
(
property
===
'
_id
'
||
property
===
'
adminLevel
'
)
{
if
(
property
===
'
_id
'
)
{
continue
;
}
user
[
property
]
=
req
.
body
.
user
[
property
];
}
}
else
{
return
res
.
send
({
success
:
false
,
message
:
'
Invalid authorization
'
});
return
res
.
status
(
403
).
send
({
success
:
false
,
message
:
'
Invalid authorization
'
});
}
// save the changes
...
...
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