diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 5d9677249..076623aa7 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -43,7 +43,6 @@ class ProtocolsController < ApplicationController update_from_parent_modal delete_steps ) - before_action :check_manage_all_in_repository_permissions, only: :make_private before_action :check_restore_all_in_repository_permissions, only: :restore before_action :check_archive_all_in_repository_permissions, only: :archive before_action :check_load_from_repository_views_permissions, only: %i( @@ -1011,7 +1010,7 @@ class ProtocolsController < ApplicationController @protocol = Protocol.find_by(id: params[:id]) render_403 unless @protocol.present? && (can_manage_protocol_in_module?(@protocol) || - can_manage_protocol_in_repository?(@protocol)) + can_manage_protocol_draft_in_repository?(@protocol)) end def check_save_as_draft_permissions @@ -1025,16 +1024,6 @@ class ProtocolsController < ApplicationController can_delete_protocol_draft_in_repository?(@protocol) end - def check_manage_all_in_repository_permissions - @protocols = Protocol.where(id: params[:protocol_ids]) - @protocols.find_each do |protocol| - unless can_manage_protocol_in_repository?(protocol) - respond_to { |f| f.json { render json: {}, status: :unauthorized } } - break - end - end - end - def check_archive_all_in_repository_permissions @protocols = Protocol.where(id: params[:protocol_ids]) @protocols.find_each do |protocol| diff --git a/app/datatables/protocols_datatable.rb b/app/datatables/protocols_datatable.rb index de43e415c..ceb600a2e 100644 --- a/app/datatables/protocols_datatable.rb +++ b/app/datatables/protocols_datatable.rb @@ -8,12 +8,6 @@ class ProtocolsDatatable < CustomDatatable PREFIXED_ID_SQL = "('#{Protocol::ID_PREFIX}' || COALESCE(\"protocols\".\"parent_id\", \"protocols\".\"id\"))" - def_delegator :@view, :can_read_protocol_in_repository? - def_delegator :@view, :can_manage_protocol_in_repository? - def_delegator :@view, :edit_protocol_path - def_delegator :@view, :can_restore_protocol_in_repository? - def_delegator :@view, :can_clone_protocol_in_repository? - def_delegator :@view, :clone_protocol_path def_delegator :@view, :linked_children_protocol_path def_delegator :@view, :protocol_path diff --git a/app/views/protocols/index/_protocol_versions_modal.html.erb b/app/views/protocols/index/_protocol_versions_modal.html.erb index 7286cd84a..de8564469 100644 --- a/app/views/protocols/index/_protocol_versions_modal.html.erb +++ b/app/views/protocols/index/_protocol_versions_modal.html.erb @@ -44,7 +44,7 @@ <% end %>
- <% if can_publish_protocol_in_repository?(draft) %> + <% if can_manage_protocol_draft_in_repository?(draft) %>
<% end %> -<% elsif can_manage_protocol_in_repository?(step.protocol) %> +<% elsif can_read_protocol_in_repository?(step.protocol) %> <%= route_to_other_team protocol_path(step.protocol), step.protocol.team, text %>