Magento: Detect if admin is logged in in frontend pages

后端 未结 12 796
轻奢々
轻奢々 2021-02-04 00:09

I have created a magento extension. I want to implement access to the extension. The extension creates a page in frontend and i want only admin to access that page. So basically

12条回答
  •  面向向阳花
    2021-02-04 01:05

    Apart from trying to pull session id from adminhtml cookie, which may or may not work IMHO is better just to "skin" page you need to show to look like its in frontend and use admin controller so it will run under admin session.

    Another solution is to "copy" customer from admin to frontend and log them in before hitting your page and then its the matter of just checking if logged in customer is member of some group.

提交回复
热议问题