Skip to content

Commit fdefc5b

Browse files
committed
fix: Change order of tenant_id in the params
1 parent dc3c493 commit fdefc5b

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

supertokens_python/recipe/userroles/asyncio/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async def add_role_to_user(
2525
if user_context is None:
2626
user_context = {}
2727
return await UserRolesRecipe.get_instance().recipe_implementation.add_role_to_user(
28-
tenant_id, user_id, role, user_context
28+
user_id, role, tenant_id, user_context
2929
)
3030

3131

@@ -38,7 +38,7 @@ async def remove_user_role(
3838
if user_context is None:
3939
user_context = {}
4040
return await UserRolesRecipe.get_instance().recipe_implementation.remove_user_role(
41-
tenant_id, user_id, role, user_context
41+
user_id, role, tenant_id, user_context
4242
)
4343

4444

@@ -49,7 +49,7 @@ async def get_roles_for_user(
4949
user_context = {}
5050
return (
5151
await UserRolesRecipe.get_instance().recipe_implementation.get_roles_for_user(
52-
tenant_id, user_id, user_context
52+
user_id, tenant_id, user_context
5353
)
5454
)
5555

@@ -60,7 +60,7 @@ async def get_users_that_have_role(
6060
if user_context is None:
6161
user_context = {}
6262
return await UserRolesRecipe.get_instance().recipe_implementation.get_users_that_have_role(
63-
tenant_id, role, user_context
63+
role, tenant_id, user_context
6464
)
6565

6666

supertokens_python/recipe/userroles/interfaces.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,25 @@ def __init__(self, roles: List[str]):
5858
class RecipeInterface(ABC):
5959
@abstractmethod
6060
async def add_role_to_user(
61-
self, tenant_id: str, user_id: str, role: str, user_context: Dict[str, Any]
61+
self, user_id: str, role: str, tenant_id: str, user_context: Dict[str, Any]
6262
) -> Union[AddRoleToUserOkResult, UnknownRoleError]:
6363
pass
6464

6565
@abstractmethod
6666
async def remove_user_role(
67-
self, tenant_id: str, user_id: str, role: str, user_context: Dict[str, Any]
67+
self, user_id: str, role: str, tenant_id: str, user_context: Dict[str, Any]
6868
) -> Union[RemoveUserRoleOkResult, UnknownRoleError]:
6969
pass
7070

7171
@abstractmethod
7272
async def get_roles_for_user(
73-
self, tenant_id: str, user_id: str, user_context: Dict[str, Any]
73+
self, user_id: str, tenant_id: str, user_context: Dict[str, Any]
7474
) -> GetRolesForUserOkResult:
7575
pass
7676

7777
@abstractmethod
7878
async def get_users_that_have_role(
79-
self, tenant_id: str, role: str, user_context: Dict[str, Any]
79+
self, role: str, tenant_id: str, user_context: Dict[str, Any]
8080
) -> Union[GetUsersThatHaveRoleOkResult, UnknownRoleError]:
8181
pass
8282

supertokens_python/recipe/userroles/recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ async def fetch_value(
151151
recipe = UserRolesRecipe.get_instance()
152152

153153
user_roles = await recipe.recipe_implementation.get_roles_for_user(
154-
user_id, tenant_id, user_context
154+
tenant_id, user_id, user_context
155155
)
156156

157157
user_permissions: Set[str] = set()
@@ -185,7 +185,7 @@ async def fetch_value(
185185
) -> List[str]:
186186
recipe = UserRolesRecipe.get_instance()
187187
res = await recipe.recipe_implementation.get_roles_for_user(
188-
user_id, tenant_id, user_context
188+
tenant_id, user_id, user_context
189189
)
190190
return res.roles
191191

supertokens_python/recipe/userroles/recipe_implementation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, querier: Querier):
4040
self.querier = querier
4141

4242
async def add_role_to_user(
43-
self, tenant_id: str, user_id: str, role: str, user_context: Dict[str, Any]
43+
self, user_id: str, role: str, tenant_id: str, user_context: Dict[str, Any]
4444
) -> Union[AddRoleToUserOkResult, UnknownRoleError]:
4545
params = {"userId": user_id, "role": role}
4646
response = await self.querier.send_put_request(
@@ -53,7 +53,7 @@ async def add_role_to_user(
5353
return UnknownRoleError()
5454

5555
async def remove_user_role(
56-
self, tenant_id: str, user_id: str, role: str, user_context: Dict[str, Any]
56+
self, user_id: str, role: str, tenant_id: str, user_context: Dict[str, Any]
5757
) -> Union[RemoveUserRoleOkResult, UnknownRoleError]:
5858
params = {"userId": user_id, "role": role}
5959
response = await self.querier.send_post_request(
@@ -66,7 +66,7 @@ async def remove_user_role(
6666
return UnknownRoleError()
6767

6868
async def get_roles_for_user(
69-
self, tenant_id: str, user_id: str, user_context: Dict[str, Any]
69+
self, user_id: str, tenant_id: str, user_context: Dict[str, Any]
7070
) -> GetRolesForUserOkResult:
7171
params = {"userId": user_id}
7272
response = await self.querier.send_get_request(
@@ -75,7 +75,7 @@ async def get_roles_for_user(
7575
return GetRolesForUserOkResult(roles=response["roles"])
7676

7777
async def get_users_that_have_role(
78-
self, tenant_id: str, role: str, user_context: Dict[str, Any]
78+
self, role: str, tenant_id: str, user_context: Dict[str, Any]
7979
) -> Union[GetUsersThatHaveRoleOkResult, UnknownRoleError]:
8080
params = {"role": role}
8181
response = await self.querier.send_get_request(

supertokens_python/recipe/userroles/syncio/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@
3131

3232

3333
def add_role_to_user(
34-
tenant_id: str, user_id: str, role: str, user_context: Union[Dict[str, Any], None] = None
34+
tenant_id: str,
35+
user_id: str,
36+
role: str,
37+
user_context: Union[Dict[str, Any], None] = None,
3538
) -> Union[AddRoleToUserOkResult, UnknownRoleError]:
3639
from supertokens_python.recipe.userroles.asyncio import add_role_to_user
3740

3841
return sync(add_role_to_user(tenant_id, user_id, role, user_context))
3942

4043

4144
def remove_user_role(
42-
tenant_id: str, user_id: str, role: str, user_context: Union[Dict[str, Any], None] = None
45+
tenant_id: str,
46+
user_id: str,
47+
role: str,
48+
user_context: Union[Dict[str, Any], None] = None,
4349
) -> Union[RemoveUserRoleOkResult, UnknownRoleError]:
4450
from supertokens_python.recipe.userroles.asyncio import remove_user_role
4551

0 commit comments

Comments
 (0)