Issues in Matching a User for a Group

Certified Associate Developer

I created a test user , he is part of LMS Engineers group 

When I ran this query, it shows true. I am trying to hide a page or component based on this result. Any help is appreciated

a!isUserMemberOfGroup(
username: "LMSTestUser",
groups: {"LMS Managing Director","LMS Managers"},
matchAllGroups:true

)

  Discussion posts and replies are publicly visible