mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
add hooks user_permission
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user