Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can't filter groups in PeoplePicker #1471

Closed
brucelane opened this issue Jan 11, 2022 · 10 comments · Fixed by #1652
Closed

[BUG] Can't filter groups in PeoplePicker #1471

brucelane opened this issue Jan 11, 2022 · 10 comments · Fixed by #1652

Comments

@brucelane
Copy link

Describe the bug
Can't filter groups in PeoplePicker

To Reproduce
Steps to reproduce the behavior:
Using the mgt-react module

const userIds=["0076...", "92f1..."];

<PeoplePicker
        type={PersonType.group}
        groupType={GroupType.security}
        selectionChanged={handleSelectionChanged}
        placeholder={placeholder}
        userIds={userIds}
      />

Expected behavior
Should filter the results for the userIds array. I get a "not found" result list instead
It works fine with users though...

Environment (please complete the following information):

  • OS: windows

  • Browser chrome

  • Framework react typescript

  • Context Web (Ionic framework)

  • Version
    "@microsoft/mgt-element": "^2.3.1",
    "@microsoft/mgt-msal-provider": "^2.3.1",
    "@microsoft/mgt-react": "^2.3.1",

  • Provider :
    ``
    export const config = {
    clientId: "ac85...",
    scopes: ['User.Read', 'openid', 'profile', 'People.Read', 'User.ReadBasic.All', 'Group.Read.All', 'GroupMember.Read.All', 'User.Read.All'],
    authority: "https://login.microsoftonline.com/6c20...",
    redirectUri: "http://localhost:3000",
    dbUrl: "https://....azurewebsites.net",
    apiUrl: "https://.../",
    signalRUrl: "https://.../api",
    locationsUrl: "https://.../api/locations-get",
    };


@brucelane brucelane added bug Something isn't working Needs: Triage 🔍 labels Jan 11, 2022
@ghost
Copy link

ghost commented Jan 11, 2022

Hello brucelane, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@brucelane brucelane changed the title [BUG] [BUG] Can't filter groups in PeoplePicker Jan 11, 2022
@vogtn
Copy link
Contributor

vogtn commented Jan 12, 2022

@brucelane

Are you getting the "no matches found result" or is it actually hanging/causing a page error? Here is a sample of the behavior, this user has no searachable users available for distribution or security, but you'll see unified and mailenabledsecurity will have group results.

https://stackblitz.com/edit/mgt-react-login-hkpwzh?file=src%2FApp.js

Are you able to get users for the other group types?

@brucelane
Copy link
Author

brucelane commented Jan 13, 2022

Yes, I used to get "no matches found result" until today.
Now I get all security groups, it doesn't filter anymore, weird.
If I change the group type to GroupType.unified or GroupType.mailenabledsecurity it doesn't filter.
Please ignore this, I was setting userIds...

@sebastienlevert
Copy link
Contributor

So this used to work @brucelane? You were using userIds but the ids in there were group ids?

@brucelane
Copy link
Author

groupId filters for one group and works fine.
I wish there was a groupIds attributes though, that would solve my problems!

@brucelane
Copy link
Author

brucelane commented Jan 18, 2022

@sebastienlevert "no matches found result" is when I set userIds attribute(with groupIds!), nevermind!

@sebastienlevert
Copy link
Contributor

We've made improvements in the latest 2.4 releast where you can pre-filter groups (users and people also). Mind validating if this would solve your issues? Thanks!

@sebastienlevert sebastienlevert added the Needs: Author Feedback Issue needs response from issue author label Mar 9, 2022
@brucelane
Copy link
Author

brucelane commented Mar 10, 2022

Thanks!
I updated my modules:
"@microsoft/mgt-element": "^2.4.0",
"@microsoft/mgt-msal2-provider": "^2.4.0",
"@microsoft/mgt-react": "^2.4.0",

I got this error since I'm now using mgt-msal2-provider

 ServerError: invalid_request: 9002326 AADSTS9002326: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type.
    at ServerError.AuthError [as constructor] (AuthError.ts:45:1)

I then did the app registration migration to SPA. The Azure was hinting clearly to update from Web to SPA, it fixed the error.

If I put

const userIds = [
   "23ea63a2-f12b-434d-b142-b437b549c1c9"
 ];
<PeoplePicker
       type={PersonType.group}
       groupType={GroupType.security}
       selectionChanged={handleSelectionChanged}
       placeholder={placeholder}
       selectionMode="single"
       userIds={userIds}
     />

I got a "not found" list whatever I type, even if don't type anything.
If I change groupType to GroupType.any I get all the groups, not filtered.

@ghost ghost added Needs: Attention 👋 Issue needs attention from mantainers and removed Needs: Author Feedback Issue needs response from issue author labels Mar 10, 2022
@musale
Copy link
Contributor

musale commented Mar 10, 2022

Hello @brucelane this will not work because you set a type of group and also userIds. So, during your search, since the type is a group, userIds are ignored. I agree with your previous comment that a groupIds attribute would help you achieve what you need here. Currently we support a single groupId which I believe we can extend to support multiple IDs or deprecate it for groupIds. We will discuss it with the team and keep you updated. Cc @sebastienlevert

@brucelane
Copy link
Author

brucelane commented Mar 10, 2022

Thanks @musale
I think groupId could be left as it is and groupIds could be added, so the behaviour is the same than userId and userIds

@sebastienlevert sebastienlevert removed this from the Future milestone Mar 10, 2022
@sebastienlevert sebastienlevert added this to the 2022-03 milestone Mar 10, 2022
@sebastienlevert sebastienlevert self-assigned this Mar 10, 2022
@sebastienlevert sebastienlevert removed the Needs: Attention 👋 Issue needs attention from mantainers label Mar 14, 2022
@ghost ghost added the State: In Review label Apr 21, 2022
@sebastienlevert sebastienlevert modified the milestones: 2022-03, 2022-06 Jun 2, 2022
@sebastienlevert sebastienlevert removed their assignment Jun 2, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.