mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ML] Fixing saved object authorization check when security is disabled (#89850)
* [ML] Fixing saved object authorization check when security is disabled * updating to use mode.useRbacForRequest for check
This commit is contained in:
parent
19332c097a
commit
178637ce29
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…
Add table
Add a link
Reference in a new issue