-- BLC_ADMIN_PERMISSION_XREF
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-33 AND ADMIN_PERMISSION_ID=-23503;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-32 AND ADMIN_PERMISSION_ID=-23502;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-31 AND ADMIN_PERMISSION_ID=-23501;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-30 AND ADMIN_PERMISSION_ID=-23500;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-201 AND ADMIN_PERMISSION_ID=-113;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-25 AND ADMIN_PERMISSION_ID=-113;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-201 AND ADMIN_PERMISSION_ID=-112;
DELETE FROM BLC_ADMIN_PERMISSION_XREF WHERE CHILD_PERMISSION_ID=-24 AND ADMIN_PERMISSION_ID=-112;
-- Remove old Search sections
DELETE FROM BLC_ADMIN_SEC_PERM_XREF WHERE ADMIN_SECTION_ID = -23500;
DELETE FROM BLC_ADMIN_SEC_PERM_XREF WHERE ADMIN_SECTION_ID = -23501;
DELETE FROM BLC_ADMIN_SECTION WHERE ADMIN_SECTION_ID = -23500;
DELETE FROM BLC_ADMIN_SECTION WHERE ADMIN_SECTION_ID = -23501;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-650;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-651;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-653;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-654;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-655;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-657;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-658;
DELETE from BLC_ADMIN_PERMISSION_ENTITY WHERE ADMIN_PERMISSION_ENTITY_ID=-659;
-- BLC_ADMIN_ROLE_PREMISSION_XREF
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-23503;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-23502;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-23501;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-23500;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-201;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-113;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-112;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-25;
DELETE FROM BLC_ADMIN_ROLE_PERMISSION_XREF WHERE ADMIN_PERMISSION_ID=-24;
-- BLC_ADMIN_PERMISSION
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-23503;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-23502;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-23501;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-23500;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-201;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-113;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-112;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-25;
DELETE FROM BLC_ADMIN_PERMISSION WHERE ADMIN_PERMISSION_ID=-24;
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33505, 'Maintain Search Fields', 1, 'PERMISSION_SEARCH_FIELD', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33504, 'View Search Fields', 1, 'PERMISSION_SEARCH_FIELD', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33503, 'Maintain Search Facets', 1, 'PERMISSION_SEARCH_FACET', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33502, 'View Search Facets', 1, 'PERMISSION_SEARCH_FACET', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33501, 'Maintain Search Redirects', 1, 'PERMISSION_SEARCH_REDIRECT', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33500, 'View Search Redirects', 1, 'PERMISSION_SEARCH_REDIRECT', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33003, 'Maintain Global Boost Rules', 1, 'PERMISSION_GLOBAL_BOOST_RULE', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33002, 'View Global Boost Rules', 1, 'PERMISSION_GLOBAL_BOOST_RULE', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33001, 'All GlobalBoostRule', 0, 'PERMISSION_ALL_GLOBAL_BOOST_RULE', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-33000, 'Read GlobalBoostRule', 0, 'PERMISSION_READ_GLOBAL_BOOST_RULE', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-24012, 'Maintain Existing Deployments', 1, 'PERMISSION_DEPLOY_EXISTING', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-24011, 'Maintain New Deployments', 1, 'PERMISSION_DEPLOY_NEW', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-24010, 'Maintain Immediate Deployments', 1, 'PERMISSION_DEPLOY_IMMEDIATE', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-24002, 'All Deploy Schedule Select Existing Access', NULL, 'PERMISSION_ALL_DEPLOY_SCHEDULE_SELECT_EXISTING', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-24001, 'All Deploy Schedule New Access', NULL, 'PERMISSION_ALL_DEPLOY_SCHEDULE_NEW', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-24000, 'All Deploy Immediate Access', NULL, 'PERMISSION_ALL_DEPLOY_IMMEDIATE', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-23031, 'Maintain Folders', 1, 'PERMISSION_FOLDERS', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-23030, 'View Folders', 1, 'PERMISSION_FOLDERS', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-23019, 'All Folders', 0, 'PERMISSION_ALL_FOLDERS', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-23018, 'Read Folders', 0, 'PERMISSION_READ_FOLDERS', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22918, 'Maintain Structured Contents', 1, 'PERMISSION_STRUCTUREDCONTENT', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22917, 'View Structured Contents', 1, 'PERMISSION_STRUCTUREDCONTENT', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22916, 'Read Structured Content Template', 0, 'PERMISSION_READ_STRUCTURED_CONTENT_TEMPLATE', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22915, 'All Structured Content', 0, 'PERMISSION_ALL_STRUCTURED_CONTENT', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22914, 'Read Structured Content', 0, 'PERMISSION_READ_STRUCTURED_CONTENT', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-14012, 'Read Offer Template', 0, 'PERMISSION_READ_OFFER_TEMPLATE', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-14011, 'All Offer Template', 0, 'PERMISSION_ALL_OFFER_TEMPLATE', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-14112, 'View Offer Offer Template', 1, 'PERMISSION_OFFER_TEMPLATE', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-14111, 'Maintain Offer Template', 1, 'PERMISSION_OFFER_TEMPLATE', 'ALL');
-- BLC_ADMIN_PERMISSION_ENTITY
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-810, 'org.broadleafcommerce.core.search.domain.IndexField', -32);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-811, 'org.broadleafcommerce.core.search.domain.IndexField', -33);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-812, 'org.broadleafcommerce.core.search.domain.IndexFieldType', -32);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-813, 'org.broadleafcommerce.core.search.domain.IndexFieldType', -33);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-14011, 'com.broadleafcommerce.advancedoffer.templates.domain.OfferTemplate', -14011);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-14012, 'com.broadleafcommerce.advancedoffer.templates.domain.OfferTemplate', -14012);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-14111, 'com.broadleafcommerce.advancedoffer.templates.domain.OfferTemplate', -10);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-14112, 'com.broadleafcommerce.advancedoffer.templates.domain.OfferTemplate', -11);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22046, 'org.broadleafcommerce.cms.structure.domain.StructuredContent', -22914);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22047, 'org.broadleafcommerce.cms.structure.domain.StructuredContent', -22915);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22048, 'org.broadleafcommerce.cms.structure.domain.StructuredContentItemCriteria', -22914);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22049, 'org.broadleafcommerce.cms.structure.domain.StructuredContentItemCriteria', -22915);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22050, 'org.broadleafcommerce.common.locale.domain.Locale', -22914);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22051, 'org.broadleafcommerce.common.locale.domain.Locale', -22915);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22052, 'org.broadleafcommerce.cms.structure.domain.StructuredContentType', -22916);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22053, 'org.broadleafcommerce.cms.structure.domain.StructuredContentFieldTemplate', -22916);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-23018, 'com.broadleafcommerce.enterprise.foldering.admin.domain.AssetFolder', -23018);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-23019, 'com.broadleafcommerce.enterprise.foldering.admin.domain.AssetFolder', -23019);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-24002, 'com.broadleafcommerce.enterprise.workflow.domain.WorkflowDeployment', -24000);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-24003, 'com.broadleafcommerce.enterprise.workflow.domain.WorkflowDeployment', -24001);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-24004, 'com.broadleafcommerce.enterprise.workflow.domain.WorkflowDeployment', -24002);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-33000, 'com.broadleafcommerce.search.domain.BoostRule', -33000);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-33001, 'com.broadleafcommerce.search.domain.BoostRule', -33001);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-33002, 'com.broadleafcommerce.search.domain.GlobalBoostRule', -33000);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-33003, 'com.broadleafcommerce.search.domain.GlobalBoostRule', -33001);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-33004, 'com.broadleafcommerce.search.domain.CategoryBoostRule', -33000);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-33005, 'com.broadleafcommerce.search.domain.CategoryBoostRule', -33001);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-33, -33505);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-32, -33504);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-33, -33503);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-32, -33502);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-31, -33501);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-30, -33500);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-33001, -33003);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-33000, -33002);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-24002, -24012);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-24001, -24011);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-24000, -24010);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-23019, -23031);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-23018, -23030);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22916, -22918);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22915, -22918);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22916, -22917);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22914, -22917);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-14012, -14112);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-10, -14112);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-14011, -14111);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-10, -14111);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33502, -33505);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33502, -33504);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33501, -33502);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33501, -33503);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33500, -33500);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33500, -33501);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33000, -33003);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-33000, -33002);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -33505);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-2, -33504);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -33503);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-2, -33502);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -33501);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-2, -33500);
--
-- The range of IDs available for the Customer Segment module is [ -17,000 to -17,999 ]
-- (see https://github.com/BroadleafCommerce/docs-internal/edit/master/Module%20IDs.md
--
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE) VALUES (-17000,'Read Customer Segment','PERMISSION_READ_CUSTOMER_SEGMENT', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE) VALUES (-17001,'All Customer Segment','PERMISSION_ALL_CUSTOMER_SEGMENT', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-17000, 'com.broadleafcommerce.customersegment.domain.CustomerSegment', -17000);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-17001, 'com.broadleafcommerce.customersegment.domain.CustomerSegment', -17001);
-- Friendly permissions
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) VALUES (-17002,'View Customer Segments','PERMISSION_CUSTOMER_SEGMENT', 'READ', TRUE);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-17002, -17000);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-17002, -18);
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) VALUES (-17003,'Maintain Customer Segments','PERMISSION_CUSTOMER_SEGMENT', 'ALL', TRUE);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-17003, -17001);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-17003, -18);
-- Allow viewing of CustomerSegments from Offer
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-106, -17000);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-107, -17000);
-- Allow viewing of CustomerSegments from PriceList
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-10002, -17000);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-10003, -17000);
-- Allow viewing of CustomerSegments from ContentTargeter
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-22912, -17000);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-22913, -17000);
--
-- Mapping from Roles to permissions
-- Site admins and content editors are allowed to do everything Customer Segments
--
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1,-17003);
--
-- Mapping sections and permissions
--
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-17000,-17002);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-17000,-17003);
-- Add sample Customer Segments
INSERT INTO BLC_CUSTOMER_SEGMENT (CUSTOMER_SEGMENT_ID, MATCH_RULE, CUSTOMER_SEGMENT_NAME, CUSTOMER_SEGMENT_TYPE) VALUES (-1, 'customer.?loggedIn==true', 'Logged In Customers', 'RULE_BASED');
INSERT INTO BLC_CUSTOMER_SEGMENT (CUSTOMER_SEGMENT_ID, MATCH_RULE, CUSTOMER_SEGMENT_NAME, CUSTOMER_SEGMENT_TYPE) VALUES (-2, 'customer.?loggedIn==false', 'Guest Customers', 'RULE_BASED');
--
-- The range of IDs available for the Merchandising Group module is [ -32,000 to -32,999 ]
-- (see https://github.com/BroadleafCommerce/docs-internal/edit/master/Module%20IDs.md)
--
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE) VALUES (-32000,'Read Product Group','PERMISSION_READ_PRODUCT_GROUP', 'READ');
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE) VALUES (-32001,'All Product Group','PERMISSION_ALL_PRODUCT_GROUP', 'ALL');
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-32000, 'com.broadleafcommerce.merchandisinggroup.domain.ProductGroup', -32000);
INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-32001, 'com.broadleafcommerce.merchandisinggroup.domain.ProductGroup', -32001);
-- Friendly permissions
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) VALUES (-32002,'View Product Groups','PERMISSION_PRODUCT_GROUP', 'READ', TRUE);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-32002, -32000);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-32002, -18);
INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, NAME, PERMISSION_TYPE, IS_FRIENDLY) VALUES (-32003,'Maintain Product Groups','PERMISSION_PRODUCT_GROUP', 'ALL', TRUE);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-32003, -32001);
INSERT INTO BLC_ADMIN_PERMISSION_XREF (ADMIN_PERMISSION_ID, CHILD_PERMISSION_ID) VALUES (-32003, -18);
--
-- Mapping from Roles to permissions
-- Site admins and content editors are allowed to do everything Product Groups
--
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1,-32003);
--
-- Mapping sections and permissions
--
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-32000,-32002);
INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-32000,-32003);
-- Admin Roles
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -23030);
INSERT INTO BLC_ADMIN_ROLE_PERMISSION_XREF (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -23031);