microsoftgraph / microsoftgraph/msgraph-sdk-python

Regression: CreateLinkPostRequestBody serializes retainInheritedPermissions=false by default starting in 1.59.2

Aperta Adatta ai principianti
#1,563 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

status:waiting-for-triage type:bug
Lingua principale
Python
Stelle
630
Fork
96
Merge medio
15h 20m
PR unite (30g)
3

Descrizione

Describe the bug

Context

I was using the CreateLinkPostRequestBody to create some link to my driveItems, and it was working properly, but at some point I noticed that some of these files would not be visible to some users anymore (inherited permissions were lost).

The "bug"

Starting with msgraph-sdk-python 1.59.2, CreateLinkPostRequestBody serializes: { "retainInheritedPermissions": false, "sendNotification": false } when these properties are not explicitly set by the caller.

This changes the behavior of the createLink API. According to the Microsoft Graph documentation, retainInheritedPermissions is optional and the service default when omitted is true .

Expected behavior

I believe that the CreateLinkPostRequestBody default attribute values should follow the defaults of the createLink API.

Thus setting retainInheritedPermissions to true (or unset) for the createLink API if not provided in CreateLinkPostRequestBody.

How to reproduce
test.py
from msgraph.generated.drives.item.items.item.create_link.create_link_post_request_body import CreateLinkPostRequestBody

request_body = CreateLinkPostRequestBody(
    type="view",
    scope="organization"
)
from kiota_serialization_json.json_serialization_writer import JsonSerializationWriter
writer = JsonSerializationWriter()


request_body.serialize(writer)
print(writer.get_serialized_content().decode('utf-8'))
Results
version 1.58.0
{
"scope": "organization",
"type": "view"
}

This will let the createLink API default the retainInheritedPermissions to True.

version 1.59.2 and 1.60.0
{
"retainInheritedPermissions": false,
"scope": "organization",
"sendNotification": false,
"type": "view"
}

This will remove existing permissions.

SDK Version

1.59.2

Latest version known to work for scenario above?

1.58.0

Known Workarounds

Explicitly adding the retain_inherited_permissions = True

request_body = CreateLinkPostRequestBody(
    retain_inherited_permissions=True,
    type="view",
    scope="organization"
)
Debug output
Click to expand log ```
</details>


### Configuration

Ubuntu 22.04
x86_64

### 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’entry point generato CreateLinkPostRequestBody mostrato nel percorso di importazione e riproduci la serializzazione usando l’esempio test.py. Confronta l’output con le versioni 1.58.0 e 1.59.2, concentrandoti sui valori omessi di retainInheritedPermissions e sendNotification. Il lavoro è completato quando le proprietà non impostate non serializzano più valori false, consentendo l’applicazione dei valori predefiniti dell’API createLink.

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

Valutazione

Stack tecnologico
python
Ambito
api
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
75/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.