mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Fix access filter and published by column [SCI-7988] (#5030)
This commit is contained in:
parent
5de5d64be5
commit
d26edb08df
2 changed files with 3 additions and 6 deletions
|
@ -70,7 +70,7 @@ class LoadFromRepositoryProtocolsDatatable < CustomDatatable
|
|||
'ON "protocol_protocol_keywords"."protocol_id" = "protocols"."id"')
|
||||
.joins('LEFT OUTER JOIN "protocol_keywords"'\
|
||||
'ON "protocol_protocol_keywords"."protocol_keyword_id" = "protocol_keywords"."id"')
|
||||
.joins('LEFT OUTER JOIN users ON users.id = protocols.added_by_id').active
|
||||
.joins('LEFT OUTER JOIN users ON users.id = protocols.published_by_id').active
|
||||
|
||||
records.group('"protocols"."id"')
|
||||
end
|
||||
|
|
|
@ -118,10 +118,7 @@ class ProtocolsDatatable < CustomDatatable
|
|||
records = records.where('protocols.updated_at > ?', params[:modified_on_from]) if params[:modified_on_from].present?
|
||||
records = records.where('protocols.updated_at < ?', params[:modified_on_to]) if params[:modified_on_to].present?
|
||||
records = records.where(protocols: { published_by_id: params[:published_by] }) if params[:published_by].present?
|
||||
|
||||
if params[:members].present?
|
||||
records = records.joins(:user_assignments).where(user_assignments: { user_id: params[:members] })
|
||||
end
|
||||
records = records.where(all_user_assignments: { user_id: params[:members] }) if params[:members].present?
|
||||
|
||||
if params[:archived_on_from].present?
|
||||
records = records.where('protocols.archived_on > ?', params[:archived_on_from])
|
||||
|
@ -162,7 +159,7 @@ class ProtocolsDatatable < CustomDatatable
|
|||
|
||||
records = records.joins('LEFT OUTER JOIN "users" "archived_users"
|
||||
ON "archived_users"."id" = "protocols"."archived_by_id"')
|
||||
records = records.joins('LEFT OUTER JOIN "users" ON "users"."id" = "protocols"."added_by_id"')
|
||||
records = records.joins('LEFT OUTER JOIN "users" ON "users"."id" = "protocols"."published_by_id"')
|
||||
|
||||
records = @type == :archived ? records.archived : records.active
|
||||
|
||||
|
|
Loading…
Reference in a new issue