microsoftgraph / microsoftgraph/msgraph-sdk-php

UserType discrepancy between enum value and Graph API response

Aperta
#1,736 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

service bug
Lingua principale
PHP
Stelle
669
Fork
150
Merge medio
15h 21m
PR unite (30g)
3

Descrizione

Describe the bug

The following Microsoft Graph API endpoint:
https://graph.microsoft.com/v1.0/users/{{azureUserId}}?$select=userType

returns

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(userType)/$entity",
  "userType": "Member"
}

However, the Microsoft\Graph\Generated\Models\UserType generated enum of the SDK contains
public const MEMBER = "member";

If an integration intends to proactively remove non-member type users from the system using code such as:

if ($azureUser->getUserType() !== UserType::MEMBER) {
    $azureUser->delete();
}

this risks removing all Azure users from the system, because an Azure user of user type member would satisfy this condition as well ('member' !== 'Member' is true).

Note: This discrepancy between the API response and the generated SDK has triggered an incident in a production environment of a software product, because the unit tests use the UserType value from the SDK.

Expected behavior

The UserType enum/const should have values capitalized.
Any other enum/consts contained in the SDK should be reviewed for correctness to be in-line with the actual API responses.

How to reproduce

See issue description. There's discrepancy between the API response and the SDK enum/const value.

SDK Version

"microsoft/microsoft-graph": "^2.3",

Latest version known to work for scenario above?

None.

Known Workarounds

Not using UserType, hardcoding sentence-cased value.

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con l'enum generato Microsoft\Graph\Generated\Models\UserType e confronta il suo valore MEMBER con la risposta del user endpoint di Microsoft Graph mostrata nell'issue. Esamina le costanti degli altri enum dell'SDK per verificare la presenza dello stesso tipo di discrepanza. Il lavoro è completato quando UserType corrisponde all'API e ogni ulteriore discrepanza individuata è stata identificata e corretta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
php
Ambito
api
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.