2

In order to restrict front side access for some admin user i need currently logged in admin user details at front side.

I have tried to get the admin session details as per below but not getting details.

Variable: protected $_adminSession;

Model: Magento\Backend\Model\Auth\Session $adminSession

Function:

$this->_adminSession->hasUser() ? (int)$this->_adminSession->getUser()->getId() : null;

Above call gives me blank value.

If someone have idea regarding the same please share here.

2 Answers 2

5

This is not possible.
Frontend and backend are separate applications and use separate sessions.
It's the same thing as Magento 1.

0

This should return admin user id.

$adminSession->getUser()->getData('user_id')

Hope it helps.

2
  • thanks for answering. I will get back to you after I tried.
    – mapaladiya
    Feb 25, 2016 at 9:54
  • its not working for me...
    – mapaladiya
    Feb 29, 2016 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.