Browse Source

FIX sync repo operate

tags/v1
Jasder 6 years ago
parent
commit
f7978b9b32
2 changed files with 6 additions and 1 deletions
  1. +5
    -0
      app/controllers/concerns/operate_project_ability_able.rb
  2. +1
    -1
      app/controllers/repositories_controller.rb

+ 5
- 0
app/controllers/concerns/operate_project_ability_able.rb 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

+ 1
- 1
app/controllers/repositories_controller.rb 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


Loading…
Cancel
Save