Trouble getting access to work

I can’t get group access to work as expected.
I’ve user1 member of group1, and user2, member of group2

What is needed in the frontmatter to:
give user1 access to page1, but not not page2
give user2 access to page2, but not not page1

All I’ve got till now is:

        login: true
        group1: true

But both users can see this page.

Example for group1:
This goes into your page’s frontmatter:

    site.group1: true

The corresponding part in user/config/groups.yaml has to look like this:

  groupname: group1
      login: 'true'
      group1: true

This was bugging me for some time.
It works great

Can this be incorporated in the excellent Manual?

I second this, too. You are right, the existing manual is misleading at this topic.