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
Can you be more specific about what are you trying to hide? Is it a site page, or something on your interface? And what problem are you facing in it?
Are you trying to only show the page if the user is part of these groups?
kowsalyavijayan said:groups: {"LMS Managing Director","LMS Managers"},
Are you actually passing in an array of STRING as your "groups" list? Or did you just write it that way here for demonstration purposes? Because if you're actually using "group name strings", then this will NOT work.
Otherwise: the code you've written here (assuming you're actually referencing groups instead of strings), would return true if and only if the user is a member of both named groups - but if the "LMS Engineers" group is a member of both of these groups, then the user would be a member by inheritance (and thus the logic would still return "true"). Have you looked at the memberships of both of these groups to verify whether or not the user is a member of them? If the user is not a member of one or both of those groups, then there might be another issue here - but that's detail we need before we can hazard any further guesses here.
yes
is there a different function to use for hiding a component? I have to two things
1. Site Page- Management Report
2. Home Page - There is a card " Approval" have to hide this one too from the group "LMS Engineers"
Perhaps you need to set matchAllGroups to false if you only want to check if the user is part of one of the groups vs the user having to be in both groups.