openfga / openfga/python-sdk

`TupleKey` should support `relation=None`

Offen
#95 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug waiting-user-feedback
Vorherrschende Sprache
Python
Sterne
85
Forks
36
Ø Merge
3 Std. 8 Min.
Gemergte PRs (30 T.)
3

Beschreibung

Checklist
  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have upgraded to the latest version of OpenFGA and the issue still persists.
  • I have searched the Slack community and have not found a suitable solution or answer.
  • I agree to the terms within the OpenFGA Code of Conduct.
Description

The docs describe how to use the read() method with a TupleKey with no relation set to get a list of all relations a user has with an object. Currently the TupleKey object validation prevents the relation from being None.

Expectation

Not to throw an error when omitting relation or setting to None.

Reproduction

Essentially the code from the docs:

body = TupleKey(
            user="user:bob",
            object="document:123",

)

Working around the validation and submitting the query confirms the behavior describes from the docs (i.e., listing the relations) works as expected:

Issuing a query with a workaround:

body = TupleKey(
            user="user:bob",
            relation="",
            object="document:123",

)
body._relation = None

# call `read(body)` ...
OpenFGA SDK version

0.4.0 (but the code in main appears broken)

OpenFGA version

v1.5.0

SDK Configuration

[default options]

Logs

No response

References

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in openfga_sdk/models/tuple_key.py bei der in der Issue referenzierten TupleKey-Validierung und reproduziere anschließend das Dokumentationsbeispiel mit read(). Fertig ist die Änderung, wenn das Erstellen von TupleKey mit ausgelassener oder auf None gesetzter relation keinen Fehler mehr auslöst und die Beziehungsabfrage die Beziehungen des Benutzers auflisten kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
authorization
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.