mirror of
https://github.com/directus/directus.git
synced 2026-01-23 03:08:08 -05:00
Fix ip check for public role
This commit is contained in:
@@ -9,7 +9,8 @@ export const checkIP: RequestHandler = asyncHandler(async (req, res, next) => {
|
||||
.from('directus_roles')
|
||||
.where({ id: req.accountability!.role })
|
||||
.first();
|
||||
const ipAllowlist = (role.ip_access || '').split(',').filter((ip: string) => ip);
|
||||
|
||||
const ipAllowlist = (role?.ip_access || '').split(',').filter((ip: string) => ip);
|
||||
|
||||
if (ipAllowlist.length > 0 && ipAllowlist.includes(req.accountability!.ip) === false)
|
||||
throw new InvalidIPException();
|
||||
|
||||
Reference in New Issue
Block a user