Fix fleet route protections (#85626)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
1e8f2f66eb
commit
96bb72f68d
|
@ -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 || [];
|
||||
|
|
Loading…
Reference in a new issue