cancel
Showing results for 
Search instead for 
Did you mean: 

How to get admin session(user) details on front side in Magento 2 ?

How to get admin session(user) details on front side in Magento 2 ?

@Magento 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.

 

Thanks in advance.