mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 12:39:08 +01:00
Check privilege
This commit is contained in:
parent
ee29e1f28f
commit
ac14fefb3c
1 changed files with 7 additions and 0 deletions
|
@ -12,6 +12,13 @@ class Ajax::QuestionController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
if not (current_user.mod? or question.user == current_user)
|
||||
@status = :not_authorized
|
||||
@message = "You are not allowed to delete this question"
|
||||
@success = false
|
||||
return
|
||||
end
|
||||
|
||||
question.destroy!
|
||||
|
||||
@status = :okay
|
||||
|
|
Loading…
Reference in a new issue