const filterByACL = (schema, options)=>{
    const { allowAll, allowMenuItemIds = [] } = options;
    if (allowAll) return schema;
    const filterSchema = (s)=>{
        if (!s) return;
        for(const key in s.properties)if (Object.prototype.hasOwnProperty.call(s.properties, key)) {
            const element = s.properties[key];
            if (element['x-uid'] && !allowMenuItemIds.includes(element['x-uid'])) delete s.properties[key];
            if (element['x-uid']) filterSchema(element);
        }
    };
    filterSchema(schema);
    return schema;
};
export { filterByACL };
