@@ -901,6 +901,10 @@ def from_request_org_and_scopes(
901
901
rpc_user_org_context : RpcUserOrganizationContext | None = None ,
902
902
scopes : Iterable [str ] | None = None ,
903
903
) -> Access :
904
+ """
905
+ Note that `scopes` is usually None because request.auth is not set at `get_authorization_header`
906
+ when the request is made from the frontend using cookies
907
+ """
904
908
is_superuser = is_active_superuser (request )
905
909
is_staff = is_active_staff (request )
906
910
@@ -929,6 +933,8 @@ def from_request_org_and_scopes(
929
933
superuser_scopes = get_superuser_scopes (auth_state , request .user , rpc_user_org_context )
930
934
if scopes :
931
935
superuser_scopes = superuser_scopes .union (set (scopes ))
936
+ if member and member .scopes :
937
+ superuser_scopes = superuser_scopes .union (set (member .scopes ))
932
938
933
939
return ApiBackedOrganizationGlobalAccess (
934
940
rpc_user_organization_context = rpc_user_org_context ,
@@ -1033,6 +1039,8 @@ def from_request(
1033
1039
superuser_scopes = get_superuser_scopes (auth_state , request .user , organization )
1034
1040
if scopes :
1035
1041
superuser_scopes = superuser_scopes .union (set (scopes ))
1042
+ if member and (member_scopes := member .get_scopes ()):
1043
+ superuser_scopes = superuser_scopes .union (set (member_scopes ))
1036
1044
1037
1045
return OrganizationGlobalAccess (
1038
1046
organization = organization ,
0 commit comments