@@ -105,14 +105,14 @@ async def is_authenticated(info: OauthInfo) -> bool:
105105 return current_user is not None
106106
107107
108- async def is_authorized (info : OauthInfo , path : str ) -> bool :
108+ async def is_authorized (info : OauthInfo , path : str , method : str ) -> bool :
109109 """Check that the user is allowed to query/mutate this path."""
110110 context = info .context
111111 current_user = await context .get_current_user
112112 if not current_user :
113113 return False
114114
115- authorization_decision = await context .auth_manager .graphql_authorization .authorize (path , current_user )
115+ authorization_decision = await context .auth_manager .graphql_authorization .authorize (path , method , current_user )
116116 authorized = bool (authorization_decision )
117117 logger .debug (
118118 "Received graphql authorization decision" ,
@@ -172,7 +172,7 @@ async def has_permission(self, source: Any, info: OauthInfo, **kwargs) -> bool:
172172 return True
173173
174174 path = get_query_path (info )
175- if await is_authorized (info , path ):
175+ if await is_authorized (info , path , "QUERY" ):
176176 return True
177177
178178 self .message = f"User is not authorized to query `{ path } `"
@@ -192,7 +192,7 @@ async def has_permission(self, source: Any, info: OauthInfo, **kwargs) -> bool:
192192 return skip_mutation_auth_checks ()
193193
194194 path = get_mutation_path (info )
195- if await is_authorized (info , path ):
195+ if await is_authorized (info , path , "POST" ):
196196 return True
197197
198198 self .message = f"User is not authorized to execute mutation `{ path } `"
0 commit comments