graphql-python / graphql-python/graphene-sqlalchemy
Question: How do you recommend enforcing authorization?
- 主要語言
- 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 沒有列出檔案、測試或進入點;請先檢視提議的 AuthZSQLAlchemyObjectType、node_authorizer 和 field_auth 介面。在實作之前,先與維護者釐清節點層級和欄位層級的預期行為,因為該 issue 沒有定義具體的變更,也沒有說明怎樣才算完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- graphql, python, sqlalchemy
- 領域
- api, authorization
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 20/100