Skip to content
Snippets Groups Projects
Commit eeff7d3f authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Avoid error if group header is not set

parent fc672f39
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment