mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 04:03:45 +08:00
Merge pull request #8035 from aignatov-bio/ai-sci-11256-fix-view-permission-for-protocol-template
Fix view permission for protocol template [SCI-11256]
This commit is contained in:
commit
abe4336eef
1 changed files with 14 additions and 2 deletions
|
@ -18,11 +18,13 @@ class ProtocolsController < ApplicationController
|
|||
print
|
||||
versions_modal
|
||||
protocol_status_bar
|
||||
linked_children
|
||||
linked_children_datatable
|
||||
versions_list
|
||||
permissions
|
||||
)
|
||||
before_action :check_linked_protocol_view_permissions, only: %i(
|
||||
linked_children
|
||||
linked_children_datatable
|
||||
)
|
||||
before_action :switch_team_with_param, only: %i(index protocolsio_index)
|
||||
before_action :check_view_all_permissions, only: %i(
|
||||
index
|
||||
|
@ -933,6 +935,16 @@ class ProtocolsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_view_permissions
|
||||
@protocol = Protocol.find_by(id: params[:id])
|
||||
current_team_switch(@protocol.team) if current_team != @protocol.team
|
||||
unless @protocol.present? &&
|
||||
(can_read_protocol_in_module?(@protocol) ||
|
||||
can_read_protocol_in_repository?(@protocol))
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def check_linked_protocol_view_permissions
|
||||
@protocol = Protocol.find_by(id: params[:id])
|
||||
current_team_switch(@protocol.team) if current_team != @protocol.team
|
||||
unless @protocol.present? &&
|
||||
|
|
Loading…
Reference in a new issue