A user's primary project role is defined by role_id on the user's Participation for the workspace if that is set. If role_id is not set on the user's participation, primary project role is defined by default_role_id on the user's account_membership only if the user's account_membership.account_id matches the workspace.account_id (the user belongs to the project's account).