add hooks user_permission
This commit is contained in:
parent
7033bccca9
commit
2151c764c7
|
@ -1,6 +1,7 @@
|
||||||
class HooksController < ApplicationController
|
class HooksController < ApplicationController
|
||||||
before_action :require_login, except: [:index, :show]
|
before_action :require_login
|
||||||
before_action :find_project_with_id
|
before_action :find_project_with_id
|
||||||
|
before_action :check_user
|
||||||
before_action :set_repository
|
before_action :set_repository
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -82,4 +83,10 @@ class HooksController < ApplicationController
|
||||||
normal_status(-1, "仓库不存在") unless @repository.present?
|
normal_status(-1, "仓库不存在") unless @repository.present?
|
||||||
normal_status(-1, "用户不存在") unless @user.present?
|
normal_status(-1, "用户不存在") unless @user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
unless @project.user_id == current_user.id
|
||||||
|
tip_exception(403, "您没有权限进入")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue