+
+ if self == Log and users_list.any?
+ # Link head points to the object described by this row
+ or_object_uuid = ", #{table_name}.object_uuid"
+
+ # This object described by this row is owned by this user, or owned by a group readable by this user
+ sql_conds += ["#{table_name}.object_owner_uuid in (?)"]
+ sql_params += [uuid_list]
+ end
+
+ # Link head points to this row, or to the owner of this row (the thing to be read)
+ #
+ # Link tail originates from this user, or a group that is readable by this
+ # user (the identity with authorization to read)
+ #
+ # Link class is 'permission' ('write' and 'manage' implicitly include 'read')
+ where(sql_conds.join(' OR '), *sql_params)
+ else
+ # At least one user is admin, so don't bother to apply any restrictions.
+ self