fix handling view permission in relation widget

This is an important update. Please review also the related ticket.