add hooks user_permission

This commit is contained in:
sylor_huang@126.com 2020-05-20 09:57:01 +08:00
parent 7033bccca9
commit 2151c764c7
1 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,7 @@
class HooksController < ApplicationController
before_action :require_login, except: [:index, :show]
before_action :require_login
before_action :find_project_with_id
before_action :check_user
before_action :set_repository
def index
@ -82,4 +83,10 @@ class HooksController < ApplicationController
normal_status(-1, "仓库不存在") unless @repository.present?
normal_status(-1, "用户不存在") unless @user.present?
end
def check_user
unless @project.user_id == current_user.id
tip_exception(403, "您没有权限进入")
end
end
end