* [ML] Fixing saved object authorization check when security is disabled * updating to use mode.useRbacForRequest for check
This commit is contained in:
parent
43927b8707
commit
420906569e
1 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,15 @@ import { ML_SAVED_OBJECT_TYPE } from '../../common/types/saved_objects';
|
|||
|
||||
export function authorizationProvider(authorization: SecurityPluginSetup['authz']) {
|
||||
async function authorizationCheck(request: KibanaRequest) {
|
||||
const shouldAuthorizeRequest = authorization?.mode.useRbacForRequest(request) ?? false;
|
||||
|
||||
if (shouldAuthorizeRequest === false) {
|
||||
return {
|
||||
canCreateGlobally: true,
|
||||
canCreateAtSpace: true,
|
||||
};
|
||||
}
|
||||
|
||||
const checkPrivilegesWithRequest = authorization.checkPrivilegesWithRequest(request);
|
||||
// Checking privileges "dynamically" will check against the current space, if spaces are enabled.
|
||||
// If spaces are disabled, then this will check privileges globally instead.
|
||||
|
|
Loading…
Reference in a new issue