We are executing the following search rest API call to retrieve all documents libraries in current site and all sub-sites. Sites are 'Modern Team Sites' which means these are connected to O365 Groups.
Search Results: Case 1
When a user who is a member of O365 Group lands on the page, the query executes and all document libraries are displayed.
Search results: Case 2
When a user who isn't a member of O365 Group lands on the page, search results are empty. No libraries are retrieved. This is even though user is a site collection administrator. As soon as we add the user to 'Office 365 Group', search results start coming up and disappear when the user is removed from the group.
This behaviour is also manifested in out-of-the-box 'HighlightedContent' webpart if we configure the webpart to show document libraries by using the ContentClass=STS_List_DocumentLibrary managed property.