FIX sync repo operate

This commit is contained in:
Jasder 2020-06-02 15:13:52 +08:00
parent 2d9b2cd942
commit f7978b9b32
2 changed files with 6 additions and 1 deletions

View File

@ -9,4 +9,9 @@ module OperateProjectAbilityAble
render_forbidden('你没有权限操作.')
end
def authorizate_user_can_edit_repo!
return if @repo.project.manager?(current_user) || current_user.admin?
render_forbidden('你没有权限操作.')
end
end

View File

@ -4,7 +4,7 @@ class RepositoriesController < ApplicationController
before_action :require_login, only: %i[edit update create_file update_file delete_file sync_mirror]
before_action :find_project, except: [:tags, :commit, :sync_mirror]
before_action :authorizate!, except: [:sync_mirror, :tags, :commit]
before_action :authorizate_user_can_edit_project!, only: %i[sync_mirror]
before_action :authorizate_user_can_edit_repo!, only: %i[sync_mirror]
before_action :find_repository_by_id, only: %i[commit sync_mirror tags]
def show