Cancancan and Ability through nested associations

Hello please how could I be able to achieve the following result written in pseudo code:

I Have a class

::Gri::Reports::Report has_many :gri_instances

::Gri::Instances::Instance has_many :compilers

What I wanna achieve is: ::Gri::Reports::Report will be visible only if current_user is included in compilers

if current_user.user?

can [:read,:update], ::Gri::Reports::Report, gri_instances: { compilers: {id: current_user.id }}

end

thanks in advance