mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
api/users/{{user}}/messages add check auth
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class Users::MessagesController < Users::BaseController
|
||||
before_action :private_user_resources!
|
||||
before_action :find_receivers, only: [:create]
|
||||
before_action :check_auth
|
||||
|
||||
def index
|
||||
limit = params[:limit] || params[:per_page]
|
||||
@@ -63,6 +64,10 @@ class Users::MessagesController < Users::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
def check_auth
|
||||
return render_forbidden unless current_user.admin? || observed_logged_user?
|
||||
end
|
||||
|
||||
def message_type
|
||||
@message_type = begin
|
||||
case params[:type]
|
||||
|
||||
Reference in New Issue
Block a user