mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 01:03:18 +08:00
Fix viewable scope for sharable models [SCI-11057]
This commit is contained in:
parent
bf1c446cc2
commit
30f9a911c2
1 changed files with 11 additions and 12 deletions
|
@ -30,18 +30,17 @@ module Shareable
|
|||
readable = readable_by_user(user).left_outer_joins(:team_shared_objects)
|
||||
readable
|
||||
.where(team: teams)
|
||||
.or(where(team_shared_objects: { team: teams }))
|
||||
.or(where(if column_names.include?('permission_level')
|
||||
{
|
||||
permission_level: [
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_read],
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_write]
|
||||
]
|
||||
}
|
||||
else
|
||||
{}
|
||||
end
|
||||
).where.not(team: teams))
|
||||
.or(model.where(team_shared_objects: { team: teams }))
|
||||
.or(model.where(if column_names.include?('permission_level')
|
||||
{
|
||||
permission_level: [
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_read],
|
||||
Extends::SHARED_OBJECTS_PERMISSION_LEVELS[:shared_write]
|
||||
]
|
||||
}
|
||||
else
|
||||
{}
|
||||
end).where.not(team: teams))
|
||||
.distinct
|
||||
}
|
||||
rescue ActiveRecord::NoDatabaseError,
|
||||
|
|
Loading…
Reference in a new issue