Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
40a6c062
Commit
40a6c062
authored
Aug 13, 2012
by
Baptiste Mouterde
Committed by
ikoalaz
Aug 13, 2012
Browse files
comment : add security check for rating own comment
parent
f33891ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/controllers/comments.py
View file @
40a6c062
...
...
@@ -257,6 +257,9 @@ class CommentsController(BaseController):
log
.
debug
(
'trying to get a comment that doesn
\'
t exist %s'
%
comment_id
)
return
msg
.
call_msg
(
'failure'
,
'this comment doesn
\'
t exist'
,
comment_id
)
# creating a comments_score
if
user
.
id
==
comment
.
user_id
:
log
.
debug
(
'user can
\'
t rate his own comments!'
)
return
msg
.
call_msg
(
'failure'
,
'you can
\'
t rate your own comment'
)
data
=
{
'user'
:
user
,
'package_comment'
:
comment
,
'value'
:
good
}
#testing if the user already vote for this
comment_score
=
meta
.
session
.
query
(
CommentsScore
).
filter_by
(
package_comments_id
=
comment
.
id
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment