Skip to content

Commit

Permalink
Modify index mapping definition code
Browse files Browse the repository at this point in the history
Signed-off-by: gaobinlong <[email protected]>
  • Loading branch information
gaobinlong committed Aug 2, 2023
1 parent b24d98e commit db26b2b
Showing 1 changed file with 16 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import crypto from 'crypto';
import { cloneDeep, mapValues } from 'lodash';
import {
IndexMapping,
SavedObjectsFieldMapping,
SavedObjectsMappingProperties,
SavedObjectsTypeMappingDefinitions,
} from './../../mappings';
Expand Down Expand Up @@ -137,6 +138,16 @@ function findChangedProp(actual: any, expected: any) {
* @returns {IndexMapping}
*/
function defaultMapping(): IndexMapping {
const principals: SavedObjectsFieldMapping = {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
};
return {
dynamic: 'strict',
properties: {
Expand Down Expand Up @@ -180,56 +191,11 @@ function defaultMapping(): IndexMapping {
},
permissions: {
properties: {
read: {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
},
write: {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
},
management: {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
},
library_read: {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
},
library_write: {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
},
read: principals,
write: principals,
management: principals,
library_read: principals,
library_write: principals,
},
},
},
Expand Down

0 comments on commit db26b2b

Please sign in to comment.