(#{sql_table}.owner_uuid = pv.target_uuid AND pv.target_owner_uuid is NOT NULL)))"]
# Match any object whose owner is listed explicitly in
# user_uuids.
- sql_conds += ["#{sql_table}.owner_uuid IN (:user_uuids)"]
+ trash_clause = if !include_trashed
+ "1 NOT IN (SELECT trashed
+ FROM permission_view pv
+ WHERE #{sql_table}.uuid = pv.target_uuid) AND"
+ else
+ ""
+ end
+ sql_conds += ["(#{trash_clause} #{sql_table}.owner_uuid IN (:user_uuids))"]
else
sql_conds += ["EXISTS(SELECT target_uuid
FROM permission_view pv
assert Group.readable_by(users(:active)).where(uuid: g_bar.uuid).empty?
assert Collection.readable_by(users(:active)).where(uuid: col.uuid).empty?
- assert Group.readable_by(users(:active), {:include_trashed => true}).where(uuid: g_foo.uuid).any?
- assert Group.readable_by(users(:active), {:include_trashed => true}).where(uuid: g_bar.uuid).any?
- assert Collection.readable_by(users(:active), {:include_trashed => true}).where(uuid: col.uuid).any?
+ set_user_from_auth :admin
+ assert Group.readable_by(users(:active)).where(uuid: g_foo.uuid).empty?
+ assert Group.readable_by(users(:active)).where(uuid: g_bar.uuid).empty?
+ assert Collection.readable_by(users(:active)).where(uuid: col.uuid).empty?
+ set_user_from_auth :active_trustedclient
g_foo.update! is_trashed: false
assert Group.readable_by(users(:active)).where(uuid: g_foo.uuid).any?
assert Group.readable_by(users(:active)).where(uuid: g_bar.uuid).any?