新增:要求登录接口处理
This commit is contained in:
parent
311776a004
commit
8239f13eaa
|
@ -1,5 +1,5 @@
|
||||||
class Api::V1::Issues::IssueTagsController < Api::V1::BaseController
|
class Api::V1::Issues::IssueTagsController < Api::V1::BaseController
|
||||||
|
before_action :require_login, except: [:index]
|
||||||
before_action :require_public_and_member_above, only: [:index]
|
before_action :require_public_and_member_above, only: [:index]
|
||||||
before_action :require_operate_above, only: [:create, :update, :destroy]
|
before_action :require_operate_above, only: [:create, :update, :destroy]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Api::V1::Issues::JournalsController < Api::V1::IssuesController
|
class Api::V1::Issues::JournalsController < Api::V1::IssuesController
|
||||||
|
before_action :require_login, except: [:index, :children_journals]
|
||||||
before_action :require_public_and_member_above, only: [:index, :create, :children_journals, :update, :destroy]
|
before_action :require_public_and_member_above, only: [:index, :create, :children_journals, :update, :destroy]
|
||||||
before_action :load_issue, only: [:index, :create, :children_journals, :update, :destroy]
|
before_action :load_issue, only: [:index, :create, :children_journals, :update, :destroy]
|
||||||
before_action :load_journal, only: [:children_journals, :update, :destroy]
|
before_action :load_journal, only: [:children_journals, :update, :destroy]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
class Api::V1::Issues::MilestonesController < Api::V1::BaseController
|
class Api::V1::Issues::MilestonesController < Api::V1::BaseController
|
||||||
|
before_action :require_login, except: [:index, :show]
|
||||||
before_action :require_public_and_member_above, only: [:index, :show]
|
before_action :require_public_and_member_above, only: [:index, :show]
|
||||||
before_action :require_operate_above, only: [:create, :update, :destroy]
|
before_action :require_operate_above, only: [:create, :update, :destroy]
|
||||||
before_action :load_milestone, only: [:show, :update, :destroy]
|
before_action :load_milestone, only: [:show, :update, :destroy]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Api::V1::IssuesController < Api::V1::BaseController
|
class Api::V1::IssuesController < Api::V1::BaseController
|
||||||
|
before_action :require_login, except: [:index, :show]
|
||||||
before_action :require_public_and_member_above, only: [:index, :show, :create, :update, :destroy]
|
before_action :require_public_and_member_above, only: [:index, :show, :create, :update, :destroy]
|
||||||
before_action :require_operate_above, only: [:batch_update, :batch_destroy]
|
before_action :require_operate_above, only: [:batch_update, :batch_destroy]
|
||||||
before_action :check_issue_operate_permission, only: [:update, :destroy]
|
before_action :check_issue_operate_permission, only: [:update, :destroy]
|
||||||
|
@ -77,7 +77,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_issue_operate_permission
|
def check_issue_operate_permission
|
||||||
return render_forbidden("您没有操作权限!") unless current_user.present? && current_user.logged? && (@project.member?(current_user) || current_user.admin? || @issue.user == current_user)
|
return render_forbidden("您没有操作权限!") unless @project.member?(current_user) || current_user.admin? || @issue.user == current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -37,16 +37,18 @@ namespace :upgrade_issue_generate_data do
|
||||||
puts "____________fix end____total:#{count}__________"
|
puts "____________fix end____total:#{count}__________"
|
||||||
end
|
end
|
||||||
|
|
||||||
# 执行示例 bundle exec rake upgrade_issue_generate_data:move_assigned_to_id_to_assigners
|
# 执行示例 bundle exec rake upgrade_issue_generate_data:build_assigners_and_participants
|
||||||
# 线上环境执行示例 RAILS_ENV=production bundle exec rake upgrade_issue_generate_data:move_assigned_to_id_to_assigners
|
# 线上环境执行示例 RAILS_ENV=production bundle exec rake upgrade_issue_generate_data:build_assigners_and_participants
|
||||||
desc "upgrade_issue_generate_data: fix issue assigner to assigners"
|
desc "upgrade_issue_generate_data: fix issue assigners and participants"
|
||||||
|
|
||||||
task move_assigned_to_id_to_assigners: :environment do
|
task build_assigners_and_participants: :environment do
|
||||||
puts "____________fix start________________"
|
puts "____________fix start________________"
|
||||||
count = 0
|
count = 0
|
||||||
Issue.where.not(assigned_to_id: nil).find_each do |issue|
|
Issue.order(created_on: :desc)find_each do |issue|
|
||||||
count += 1
|
count += 1
|
||||||
issue.assigners = User.where(id: issue.assigned_to_id)
|
issue.issue_assigners.find_or_create_by(assigner_id: issue.assigned_to_id)
|
||||||
|
issue.issue_participants.find_or_create_by(participant_id: issue.assigned_to_id, participant_type: 'assigned')
|
||||||
|
issue.issue_participants.find_or_create_by(participant_id: issue.author_id, participant_type: 'authored')
|
||||||
end
|
end
|
||||||
puts "____________fix end____total:#{count}__________"
|
puts "____________fix end____total:#{count}__________"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue