File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use Magento \Backend \Block \Template ;
66use Magento \Backend \Block \Template \Context ;
7+ use Magento \Framework \AuthorizationInterface ;
78use Magento \Framework \App \Config \ScopeConfigInterface ;
89use Magento \Store \Model \ScopeInterface ;
910
@@ -13,13 +14,17 @@ class AIAssistant extends Template
1314
1415 protected $ scopeConfig ;
1516
17+ protected $ authorization ;
18+
1619 public function __construct (
1720 Context $ context ,
1821 ScopeConfigInterface $ scopeConfig ,
22+ AuthorizationInterface $ authorization ,
1923 array $ data = []
2024 ) {
2125 parent ::__construct ($ context , $ data );
2226 $ this ->scopeConfig = $ scopeConfig ;
27+ $ this ->authorization = $ authorization ;
2328 }
2429
2530 public function getFormAction ()
@@ -34,4 +39,9 @@ public function getApiKey()
3439 ScopeInterface::SCOPE_STORE
3540 );
3641 }
37- }
42+
43+ public function isAllowed (): bool
44+ {
45+ return $ this ->authorization ->isAllowed ('Genaker_MagentoMcpAi::mcpai_dashboard_page ' );
46+ }
47+ }
Original file line number Diff line number Diff line change 66 <resource id =" Magento_Backend::content" >
77 <resource id =" Genaker_MagentoMcpAi::ai_assistant" title =" AI Assistant" sortOrder =" 100" >
88 <resource id =" Genaker_MagentoMcpAi::mcpai" title =" MCP AI Assistant" sortOrder =" 10" />
9+ <resource id =" Genaker_MagentoMcpAi::mcpai_dashboard_page" title =" MCP AI Assistant Dashboard Page" sortOrder =" 20" />
910 <resource id =" Genaker_MagentoMcpAi::product_chat" title =" Product Chat" sortOrder =" 30" />
1011 </resource >
1112 </resource >
Original file line number Diff line number Diff line change 1+ <?php
2+ /** @var Genaker\MagentoMcpAi\Block\Adminhtml\AIAssistant $block */
3+
4+ if (!$ block ->isAllowed ()) {
5+ return ;
6+ }
7+ ?>
18<style>
29.message.message:before {
310 position: absolute;
You can’t perform that action at this time.
0 commit comments