custom post types – Conditional editing CPT – using editor’s role and author’s usermeta

I have created a custom post type.

Each author is attributed to a editor group when her/his account is created.
This is save on the author’s user meta

I created two roles with administrator capabilities, one for each editor group.

I want to allow (or deny) the editors to edit the posts based on their role and on the author’s user meta.

Where can I begin?