@@ -67,31 +67,31 @@ <h1 class="title">Module <code>supertokens_python.recipe.userroles.syncio</code>
67
67
68
68
69
69
def remove_user_role(
70
- user_id: str, role: str, user_context: Dict[str, Any]
70
+ user_id: str, role: str, user_context: Union[ Dict[str, Any], None] = None
71
71
) -> Union[RemoveUserRoleOkResult, UnknownRoleError]:
72
72
from supertokens_python.recipe.userroles.asyncio import remove_user_role
73
73
74
74
return sync(remove_user_role(user_id, role, user_context))
75
75
76
76
77
77
def get_roles_for_user(
78
- user_id: str, user_context: Dict[str, Any]
78
+ user_id: str, user_context: Union[ Dict[str, Any], None] = None
79
79
) -> GetRolesForUserOkResult:
80
80
from supertokens_python.recipe.userroles.asyncio import get_roles_for_user
81
81
82
82
return sync(get_roles_for_user(user_id, user_context))
83
83
84
84
85
85
def get_users_that_have_role(
86
- role: str, user_context: Dict[str, Any]
86
+ role: str, user_context: Union[ Dict[str, Any], None] = None
87
87
) -> Union[GetUsersThatHaveRoleOkResult, UnknownRoleError]:
88
88
from supertokens_python.recipe.userroles.asyncio import get_users_that_have_role
89
89
90
90
return sync(get_users_that_have_role(role, user_context))
91
91
92
92
93
93
def create_new_role_or_add_permissions(
94
- role: str, permissions: List[str], user_context: Dict[str, Any]
94
+ role: str, permissions: List[str], user_context: Union[ Dict[str, Any], None] = None
95
95
) -> CreateNewRoleOrAddPermissionsOkResult:
96
96
from supertokens_python.recipe.userroles.asyncio import (
97
97
create_new_role_or_add_permissions,
@@ -101,23 +101,23 @@ <h1 class="title">Module <code>supertokens_python.recipe.userroles.syncio</code>
101
101
102
102
103
103
def get_permissions_for_role(
104
- role: str, user_context: Dict[str, Any]
104
+ role: str, user_context: Union[ Dict[str, Any], None] = None
105
105
) -> Union[GetPermissionsForRoleOkResult, UnknownRoleError]:
106
106
from supertokens_python.recipe.userroles.asyncio import get_permissions_for_role
107
107
108
108
return sync(get_permissions_for_role(role, user_context))
109
109
110
110
111
111
def remove_permissions_from_role(
112
- role: str, permissions: List[str], user_context: Dict[str, Any]
112
+ role: str, permissions: List[str], user_context: Union[ Dict[str, Any], None] = None
113
113
) -> Union[RemovePermissionsFromRoleOkResult, UnknownRoleError]:
114
114
from supertokens_python.recipe.userroles.asyncio import remove_permissions_from_role
115
115
116
116
return sync(remove_permissions_from_role(role, permissions, user_context))
117
117
118
118
119
119
def get_roles_that_have_permission(
120
- permission: str, user_context: Dict[str, Any]
120
+ permission: str, user_context: Union[ Dict[str, Any], None] = None
121
121
) -> GetRolesThatHavePermissionOkResult:
122
122
from supertokens_python.recipe.userroles.asyncio import (
123
123
get_roles_that_have_permission,
@@ -126,13 +126,17 @@ <h1 class="title">Module <code>supertokens_python.recipe.userroles.syncio</code>
126
126
return sync(get_roles_that_have_permission(permission, user_context))
127
127
128
128
129
- def delete_role(role: str, user_context: Dict[str, Any]) -> DeleteRoleOkResult:
129
+ def delete_role(
130
+ role: str, user_context: Union[Dict[str, Any], None] = None
131
+ ) -> DeleteRoleOkResult:
130
132
from supertokens_python.recipe.userroles.asyncio import delete_role
131
133
132
134
return sync(delete_role(role, user_context))
133
135
134
136
135
- def get_all_roles(user_context: Dict[str, Any]) -> GetAllRolesOkResult:
137
+ def get_all_roles(
138
+ user_context: Union[Dict[str, Any], None] = None
139
+ ) -> GetAllRolesOkResult:
136
140
from supertokens_python.recipe.userroles.asyncio import get_all_roles
137
141
138
142
return sync(get_all_roles(user_context))</ code > </ pre >
@@ -163,7 +167,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
163
167
</ details >
164
168
</ dd >
165
169
< dt id ="supertokens_python.recipe.userroles.syncio.create_new_role_or_add_permissions "> < code class ="name flex ">
166
- < span > def < span class ="ident "> create_new_role_or_add_permissions</ span > </ span > (< span > role: str, permissions: List[str], user_context: Dict[str, Any]) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.CreateNewRoleOrAddPermissionsOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.CreateNewRoleOrAddPermissionsOkResult "> CreateNewRoleOrAddPermissionsOkResult</ a > </ span >
170
+ < span > def < span class ="ident "> create_new_role_or_add_permissions</ span > </ span > (< span > role: str, permissions: List[str], user_context: Optional[ Dict[str, Any]] = None ) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.CreateNewRoleOrAddPermissionsOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.CreateNewRoleOrAddPermissionsOkResult "> CreateNewRoleOrAddPermissionsOkResult</ a > </ span >
167
171
</ code > </ dt >
168
172
< dd >
169
173
< div class ="desc "> </ div >
@@ -172,7 +176,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
172
176
< span > Expand source code</ span >
173
177
</ summary >
174
178
< pre > < code class ="python "> def create_new_role_or_add_permissions(
175
- role: str, permissions: List[str], user_context: Dict[str, Any]
179
+ role: str, permissions: List[str], user_context: Union[ Dict[str, Any], None] = None
176
180
) -> CreateNewRoleOrAddPermissionsOkResult:
177
181
from supertokens_python.recipe.userroles.asyncio import (
178
182
create_new_role_or_add_permissions,
@@ -182,37 +186,41 @@ <h2 class="section-title" id="header-functions">Functions</h2>
182
186
</ details >
183
187
</ dd >
184
188
< dt id ="supertokens_python.recipe.userroles.syncio.delete_role "> < code class ="name flex ">
185
- < span > def < span class ="ident "> delete_role</ span > </ span > (< span > role: str, user_context: Dict[str, Any]) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.DeleteRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.DeleteRoleOkResult "> DeleteRoleOkResult</ a > </ span >
189
+ < span > def < span class ="ident "> delete_role</ span > </ span > (< span > role: str, user_context: Optional[ Dict[str, Any]] = None ) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.DeleteRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.DeleteRoleOkResult "> DeleteRoleOkResult</ a > </ span >
186
190
</ code > </ dt >
187
191
< dd >
188
192
< div class ="desc "> </ div >
189
193
< details class ="source ">
190
194
< summary >
191
195
< span > Expand source code</ span >
192
196
</ summary >
193
- < pre > < code class ="python "> def delete_role(role: str, user_context: Dict[str, Any]) -> DeleteRoleOkResult:
197
+ < pre > < code class ="python "> def delete_role(
198
+ role: str, user_context: Union[Dict[str, Any], None] = None
199
+ ) -> DeleteRoleOkResult:
194
200
from supertokens_python.recipe.userroles.asyncio import delete_role
195
201
196
202
return sync(delete_role(role, user_context))</ code > </ pre >
197
203
</ details >
198
204
</ dd >
199
205
< dt id ="supertokens_python.recipe.userroles.syncio.get_all_roles "> < code class ="name flex ">
200
- < span > def < span class ="ident "> get_all_roles</ span > </ span > (< span > user_context: Dict[str, Any]) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.GetAllRolesOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetAllRolesOkResult "> GetAllRolesOkResult</ a > </ span >
206
+ < span > def < span class ="ident "> get_all_roles</ span > </ span > (< span > user_context: Optional[ Dict[str, Any]] = None ) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.GetAllRolesOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetAllRolesOkResult "> GetAllRolesOkResult</ a > </ span >
201
207
</ code > </ dt >
202
208
< dd >
203
209
< div class ="desc "> </ div >
204
210
< details class ="source ">
205
211
< summary >
206
212
< span > Expand source code</ span >
207
213
</ summary >
208
- < pre > < code class ="python "> def get_all_roles(user_context: Dict[str, Any]) -> GetAllRolesOkResult:
214
+ < pre > < code class ="python "> def get_all_roles(
215
+ user_context: Union[Dict[str, Any], None] = None
216
+ ) -> GetAllRolesOkResult:
209
217
from supertokens_python.recipe.userroles.asyncio import get_all_roles
210
218
211
219
return sync(get_all_roles(user_context))</ code > </ pre >
212
220
</ details >
213
221
</ dd >
214
222
< dt id ="supertokens_python.recipe.userroles.syncio.get_permissions_for_role "> < code class ="name flex ">
215
- < span > def < span class ="ident "> get_permissions_for_role</ span > </ span > (< span > role: str, user_context: Dict[str, Any]) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.GetPermissionsForRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetPermissionsForRoleOkResult "> GetPermissionsForRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
223
+ < span > def < span class ="ident "> get_permissions_for_role</ span > </ span > (< span > role: str, user_context: Optional[ Dict[str, Any]] = None ) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.GetPermissionsForRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetPermissionsForRoleOkResult "> GetPermissionsForRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
216
224
</ code > </ dt >
217
225
< dd >
218
226
< div class ="desc "> </ div >
@@ -221,15 +229,15 @@ <h2 class="section-title" id="header-functions">Functions</h2>
221
229
< span > Expand source code</ span >
222
230
</ summary >
223
231
< pre > < code class ="python "> def get_permissions_for_role(
224
- role: str, user_context: Dict[str, Any]
232
+ role: str, user_context: Union[ Dict[str, Any], None] = None
225
233
) -> Union[GetPermissionsForRoleOkResult, UnknownRoleError]:
226
234
from supertokens_python.recipe.userroles.asyncio import get_permissions_for_role
227
235
228
236
return sync(get_permissions_for_role(role, user_context))</ code > </ pre >
229
237
</ details >
230
238
</ dd >
231
239
< dt id ="supertokens_python.recipe.userroles.syncio.get_roles_for_user "> < code class ="name flex ">
232
- < span > def < span class ="ident "> get_roles_for_user</ span > </ span > (< span > user_id: str, user_context: Dict[str, Any]) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.GetRolesForUserOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetRolesForUserOkResult "> GetRolesForUserOkResult</ a > </ span >
240
+ < span > def < span class ="ident "> get_roles_for_user</ span > </ span > (< span > user_id: str, user_context: Optional[ Dict[str, Any]] = None ) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.GetRolesForUserOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetRolesForUserOkResult "> GetRolesForUserOkResult</ a > </ span >
233
241
</ code > </ dt >
234
242
< dd >
235
243
< div class ="desc "> </ div >
@@ -238,15 +246,15 @@ <h2 class="section-title" id="header-functions">Functions</h2>
238
246
< span > Expand source code</ span >
239
247
</ summary >
240
248
< pre > < code class ="python "> def get_roles_for_user(
241
- user_id: str, user_context: Dict[str, Any]
249
+ user_id: str, user_context: Union[ Dict[str, Any], None] = None
242
250
) -> GetRolesForUserOkResult:
243
251
from supertokens_python.recipe.userroles.asyncio import get_roles_for_user
244
252
245
253
return sync(get_roles_for_user(user_id, user_context))</ code > </ pre >
246
254
</ details >
247
255
</ dd >
248
256
< dt id ="supertokens_python.recipe.userroles.syncio.get_roles_that_have_permission "> < code class ="name flex ">
249
- < span > def < span class ="ident "> get_roles_that_have_permission</ span > </ span > (< span > permission: str, user_context: Dict[str, Any]) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.GetRolesThatHavePermissionOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetRolesThatHavePermissionOkResult "> GetRolesThatHavePermissionOkResult</ a > </ span >
257
+ < span > def < span class ="ident "> get_roles_that_have_permission</ span > </ span > (< span > permission: str, user_context: Optional[ Dict[str, Any]] = None ) ‑> < a title ="supertokens_python.recipe.userroles.interfaces.GetRolesThatHavePermissionOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetRolesThatHavePermissionOkResult "> GetRolesThatHavePermissionOkResult</ a > </ span >
250
258
</ code > </ dt >
251
259
< dd >
252
260
< div class ="desc "> </ div >
@@ -255,7 +263,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
255
263
< span > Expand source code</ span >
256
264
</ summary >
257
265
< pre > < code class ="python "> def get_roles_that_have_permission(
258
- permission: str, user_context: Dict[str, Any]
266
+ permission: str, user_context: Union[ Dict[str, Any], None] = None
259
267
) -> GetRolesThatHavePermissionOkResult:
260
268
from supertokens_python.recipe.userroles.asyncio import (
261
269
get_roles_that_have_permission,
@@ -265,7 +273,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
265
273
</ details >
266
274
</ dd >
267
275
< dt id ="supertokens_python.recipe.userroles.syncio.get_users_that_have_role "> < code class ="name flex ">
268
- < span > def < span class ="ident "> get_users_that_have_role</ span > </ span > (< span > role: str, user_context: Dict[str, Any]) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.GetUsersThatHaveRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetUsersThatHaveRoleOkResult "> GetUsersThatHaveRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
276
+ < span > def < span class ="ident "> get_users_that_have_role</ span > </ span > (< span > role: str, user_context: Optional[ Dict[str, Any]] = None ) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.GetUsersThatHaveRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.GetUsersThatHaveRoleOkResult "> GetUsersThatHaveRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
269
277
</ code > </ dt >
270
278
< dd >
271
279
< div class ="desc "> </ div >
@@ -274,15 +282,15 @@ <h2 class="section-title" id="header-functions">Functions</h2>
274
282
< span > Expand source code</ span >
275
283
</ summary >
276
284
< pre > < code class ="python "> def get_users_that_have_role(
277
- role: str, user_context: Dict[str, Any]
285
+ role: str, user_context: Union[ Dict[str, Any], None] = None
278
286
) -> Union[GetUsersThatHaveRoleOkResult, UnknownRoleError]:
279
287
from supertokens_python.recipe.userroles.asyncio import get_users_that_have_role
280
288
281
289
return sync(get_users_that_have_role(role, user_context))</ code > </ pre >
282
290
</ details >
283
291
</ dd >
284
292
< dt id ="supertokens_python.recipe.userroles.syncio.remove_permissions_from_role "> < code class ="name flex ">
285
- < span > def < span class ="ident "> remove_permissions_from_role</ span > </ span > (< span > role: str, permissions: List[str], user_context: Dict[str, Any]) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.RemovePermissionsFromRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.RemovePermissionsFromRoleOkResult "> RemovePermissionsFromRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
293
+ < span > def < span class ="ident "> remove_permissions_from_role</ span > </ span > (< span > role: str, permissions: List[str], user_context: Optional[ Dict[str, Any]] = None ) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.RemovePermissionsFromRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.RemovePermissionsFromRoleOkResult "> RemovePermissionsFromRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
286
294
</ code > </ dt >
287
295
< dd >
288
296
< div class ="desc "> </ div >
@@ -291,15 +299,15 @@ <h2 class="section-title" id="header-functions">Functions</h2>
291
299
< span > Expand source code</ span >
292
300
</ summary >
293
301
< pre > < code class ="python "> def remove_permissions_from_role(
294
- role: str, permissions: List[str], user_context: Dict[str, Any]
302
+ role: str, permissions: List[str], user_context: Union[ Dict[str, Any], None] = None
295
303
) -> Union[RemovePermissionsFromRoleOkResult, UnknownRoleError]:
296
304
from supertokens_python.recipe.userroles.asyncio import remove_permissions_from_role
297
305
298
306
return sync(remove_permissions_from_role(role, permissions, user_context))</ code > </ pre >
299
307
</ details >
300
308
</ dd >
301
309
< dt id ="supertokens_python.recipe.userroles.syncio.remove_user_role "> < code class ="name flex ">
302
- < span > def < span class ="ident "> remove_user_role</ span > </ span > (< span > user_id: str, role: str, user_context: Dict[str, Any]) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.RemoveUserRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.RemoveUserRoleOkResult "> RemoveUserRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
310
+ < span > def < span class ="ident "> remove_user_role</ span > </ span > (< span > user_id: str, role: str, user_context: Optional[ Dict[str, Any]] = None ) ‑> Union[< a title ="supertokens_python.recipe.userroles.interfaces.RemoveUserRoleOkResult " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.RemoveUserRoleOkResult "> RemoveUserRoleOkResult</ a > , < a title ="supertokens_python.recipe.userroles.interfaces.UnknownRoleError " href ="../interfaces.html#supertokens_python.recipe.userroles.interfaces.UnknownRoleError "> UnknownRoleError</ a > ]</ span >
303
311
</ code > </ dt >
304
312
< dd >
305
313
< div class ="desc "> </ div >
@@ -308,7 +316,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
308
316
< span > Expand source code</ span >
309
317
</ summary >
310
318
< pre > < code class ="python "> def remove_user_role(
311
- user_id: str, role: str, user_context: Dict[str, Any]
319
+ user_id: str, role: str, user_context: Union[ Dict[str, Any], None] = None
312
320
) -> Union[RemoveUserRoleOkResult, UnknownRoleError]:
313
321
from supertokens_python.recipe.userroles.asyncio import remove_user_role
314
322
0 commit comments