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

Parents
  • 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.

Reply
  • 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.

Children
No Data