Fix fleet route protections (#85626)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Larry Gregory 2020-12-13 12:40:50 -05:00 committed by GitHub
parent 1e8f2f66eb
commit 96bb72f68d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,12 @@ export function enforceSuperUser<T1, T2, T3>(
const security = appContextService.getSecurity();
const user = security.authc.getCurrentUser(req);
if (!user) {
return res.unauthorized();
return res.forbidden({
body: {
message:
'Access to Fleet API require the superuser role, and for stack security features to be enabled.',
},
});
}
const userRoles = user.roles || [];