microsoftgraph / microsoftgraph/msgraph-sdk-python

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

Ouverte Adaptée aux débutants
#1,563 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

status:waiting-for-triage type:bug
Langage dominant
Python
Étoiles
630
Forks
96
Merge moyen
15 h 20 min
PR mergées (30 j)
3

Description

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_

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le point d’entrée généré CreateLinkPostRequestBody montré dans le chemin d’importation et reproduisez la sérialisation à l’aide de l’exemple test.py. Comparez la sortie avec les versions 1.58.0 et 1.59.2, en vous concentrant sur les valeurs omises de retainInheritedPermissions et sendNotification. C’est terminé lorsque les propriétés non définies ne sérialisent plus de valeurs false, ce qui permet d’appliquer les valeurs par défaut de l’API createLink.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
api
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Calme
Clarté
Clairement spécifiée
Accessibilité débutants
75/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.