Third and fourth level associations

I have 5 tables
users, profiles, groups, rights and users_profiles
Now I associate
users belongsToMany users_profiles
profiles belongsToMany groups
profiles belongsToMany rights using profiles_rights

from users model/controller I want to access groups and rights, but I am not able to

in users I cannot create association to groups and rights as there is no linking (user.id or group.id) any association would be through profiles. but in this case even through profile I am not able to associate.

Please help