graphql-python / graphql-python/graphene-sqlalchemy

Question: How do you recommend enforcing authorization?

オープン
#186 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
Python
スター
985
フォーク
223
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello,

I'd like to systematically enforce authorization for nodes and individual fields within the nodes.

Conceptually something like this might work:

```python
class MyNode(AuthZSQLAlchemyObjectType):
class Meta:
model = MyModel
authorize_node_function = node_authorizer
field_auth = dict(
"name": all_authorizer,
"private_things": self_only_authorizer,
)
```

`node_authorizer(model_instance)` would get called whenever a new Node of that type is created. Only fields in the field_auth dict would be exposed in node, and then the associated function would be called like `resolve_authorizer(model_instance, field_name)`

Any opinions on the best way to achieve this?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。