feat: make routing per role, add unlogged role

This commit is contained in:
2026-04-14 09:49:37 +02:00
parent 26cbdeec0a
commit 967b101f9b
13 changed files with 128 additions and 36 deletions

View File

@@ -42,6 +42,11 @@ INSERT IGNORE INTO `b2b_top_menu` (`menu_id`, `label`, `parent_id`, `params`, `a
(3, JSON_COMPACT('{"name":"admin-products","trans":{"pl":{"label":"admin-products"},"en":{"label":"admin-products"},"de":{"label":"admin-products"}}}'),1,JSON_COMPACT('{}'),1,1),
(9, JSON_COMPACT('{"name":"carts","trans":{"pl":{"label":"Koszyki"},"en":{"label":"Carts"},"de":{"label":"Warenkörbe"}}}'),3,JSON_COMPACT('{"route": {"name": "home", "params":{"locale": ""}}}'),1,1);
CREATE TABLE `b2b_route_roles` (
`route_id` INT NOT NULL,
`role_id` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`, `role_id`)
);
-- +goose Down

View File

@@ -310,6 +310,24 @@ ON b2b_specific_price_customer (b2b_id_customer);
CREATE INDEX idx_bsp_country_rel
ON b2b_specific_price_country (b2b_id_country);
CREATE TABLE b2b_route_roles (
route_id INT NOT NULL,
role_id BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (route_id, role_id),
INDEX idx_role_id (role_id),
INDEX idx_route_id (route_id),
CONSTRAINT FK_b2b_route_roles_route_id
FOREIGN KEY (route_id)
REFERENCES b2b_routes (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT FK_b2b_route_roles_role_id
FOREIGN KEY (role_id)
REFERENCES b2b_roles (id)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB;
DELIMITER //
CREATE FUNCTION IF NOT EXISTS slugify_eu(input TEXT)
@@ -415,3 +433,4 @@ DROP TABLE IF EXISTS b2b_specific_price;
DROP TABLE IF EXISTS b2b_specific_price_product;
DROP TABLE IF EXISTS b2b_specific_price_category;
DROP TABLE IF EXISTS b2b_specific_price_product_attribute;
DROP TABLE IF EXISTS b2b_route_roles;

View File

@@ -46,4 +46,34 @@ INSERT INTO `b2b_role_permissions` (`role_id`, `permission_id`) VALUES ('3', '2'
INSERT INTO `b2b_role_permissions` (`role_id`, `permission_id`) VALUES ('3', '3');
INSERT INTO `b2b_role_permissions` (`role_id`, `permission_id`) VALUES ('3', '4');
INSERT INTO `b2b_role_permissions` (`role_id`, `permission_id`) VALUES ('3', '5');
INSERT INTO `b2b_route_roles` (`route_id`, `role_id`) VALUES
(1, '1'),
(1, '2'),
(1, '3'),
(2, '1'),
(2, '2'),
(2, '3'),
(3, '1'),
(3, '2'),
(3, '3'),
(3, '4'),
(4, '1'),
(4, '2'),
(4, '3'),
(4, '4'),
(5, '1'),
(5, '2'),
(5, '3'),
(5, '4'),
(6, '1'),
(6, '2'),
(6, '3'),
(6, '4'),
(7, '1'),
(7, '2'),
(7, '3'),
(7, '4');
-- +goose Down