giang
giang

Reputation: 33

Broadleaf commerce: "Access is denied" with custom admin controller

I am new to Broadleaf. I followed the guideline https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/admin/admin-custom-controllers to add new module and section to Admin demo site.

I added following SQL commands to core/broadleaf-framework/src/main/resources/config/bc/sql/load_admin_menu.sql

INSERT INTO BLC_ADMIN_MODULE (ADMIN_MODULE_ID, DISPLAY_ORDER, ICON, MODULE_KEY, NAME) VALUES (1, 7, 'icon-barcode', 'MyCustomModule', 'My Custom Module');

INSERT INTO BLC_ADMIN_SECTION (ADMIN_SECTION_ID, DISPLAY_ORDER, NAME, SECTION_KEY, URL, ADMIN_MODULE_ID) VALUES (1, 1000, 'My Custom Section', 'MyCustomSection', '/test', 1);

INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (1, -1);

When admin demo site was up, the module and section appeared. However, when I clicked on section "My Custom Section", the console show message: "Access is denied".

I would appreciate any help! Thanks!

Upvotes: 1

Views: 231

Answers (1)

charchar
charchar

Reputation: 96

Looks like you are missing the SQL for the Admin Permission Entity and Admin Permissions. You need a mapping from your permission to the Java entity to determine if that permission can handle actions on it. You can find examples here: https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/admin/admin-custom-entities

Upvotes: 2

Related Questions