File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -151,15 +151,14 @@ async def _verify_access_helper(
151
151
return
152
152
153
153
form = models .Form (** form )
154
+ role_id_lookup = {role .id : role for role in await get_roles ()}
154
155
155
- for role_id in getattr (form , attribute , None ) or []:
156
- role = await request .state .db .roles .find_one ({"id" : role_id })
157
- if not role :
158
- continue
159
-
160
- role = models .DiscordRole (** json .loads (role ["data" ]))
156
+ for role_name_or_id in getattr (form , attribute , None ) or []:
157
+ if role_name_or_id in request .auth .scopes :
158
+ return
161
159
162
- if role .name in request .auth .scopes :
160
+ role = role_id_lookup .get (role_name_or_id )
161
+ if role and role .name in request .auth .scopes :
163
162
return
164
163
165
164
raise UnauthorizedError (status_code = 401 )
You can’t perform that action at this time.
0 commit comments