Commit eeff7d3f authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Avoid error if group header is not set

parent fc672f39
Pipeline #2484 passed with stages
in 30 seconds
......@@ -20,8 +20,15 @@ export class GroupsGuard implements CanActivate {
// Get the group from the header
const request = context.switchToHttp().getRequest();
const consumerGroups = request.headers[this.configService.config.groupHeader].split(',').map(e => e.trim());
const groupHeader = request.headers[this.configService.config.groupHeader];
if (!groupHeader) {
return false;
}
const consumerGroups = groupHeader.split(',').map(e => e.trim());
const hasGroup = () => consumerGroups.some((group) => groups.includes(group));
return consumerGroups && hasGroup();
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment