mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
check the permissions in before action
This commit is contained in:
parent
04a6645cfc
commit
1bf6663196
1 changed files with 7 additions and 2 deletions
|
@ -12,8 +12,9 @@ class RepositoryRowsController < ApplicationController
|
|||
copy_records
|
||||
available_rows)
|
||||
before_action :check_create_permissions, only: :create
|
||||
before_action :check_delete_permissions, only: :delete_records
|
||||
before_action :check_manage_permissions,
|
||||
only: %i(edit update delete_records copy_records)
|
||||
only: %i(edit update copy_records)
|
||||
|
||||
def index
|
||||
@draw = params[:draw].to_i
|
||||
|
@ -270,7 +271,6 @@ class RepositoryRowsController < ApplicationController
|
|||
end
|
||||
|
||||
def delete_records
|
||||
render_403 unless can_delete_repository_rows?(@repository)
|
||||
deleted_count = 0
|
||||
if selected_params
|
||||
selected_params.each do |row_id|
|
||||
|
@ -373,6 +373,11 @@ class RepositoryRowsController < ApplicationController
|
|||
render_403 unless can_manage_repository_rows?(@repository)
|
||||
end
|
||||
|
||||
|
||||
def check_delete_permissions
|
||||
render_403 unless can_delete_repository_rows?(@repository)
|
||||
end
|
||||
|
||||
def record_params
|
||||
params.permit(:repository_row_name).to_h
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue