astorm / magento_crossareasessions Goto Github PK
View Code? Open in Web Editor NEWResearch module providing a manager for accessing admin sessions from the frontend, and vice/versa.
License: MIT License
Research module providing a manager for accessing admin sessions from the frontend, and vice/versa.
License: MIT License
Example:
Logged in to the backend, when I try using the following code on the frontend:
$adminhtml = Mage::getModel('pulsestorm_crossareasession/manager')
->getSessionData('adminhtml');
Mage::log($adminhtml);
I get an empty array
I can't seem to find out what is going on - every time I load session data with getSessionData, it does not include a "user" element under the "admin" array.
It seems to be loading an empty session, rather than the one that is live in my browser.
Any ideas?
require_once ('../app/Mage.php');
Mage::app();
// Ensure we're in the admin session namespace for checking the admin user..
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$adminhtml = Mage::getModel('pulsestorm_crossareasession/manager')
->getSessionData('adminhtml');
var_export($adminhtml);
Output is:
array ( 'core' => array ( '_session_validator_data' => array ( 'remote_addr' => '[[ip]]', 'http_via' => '', 'http_x_forwarded_for' => '', 'http_user_agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36', ), 'session_hosts' => array ( 'mydomain.com' => true, ), ), 'admin' => array ( '_session_validator_data' => array ( 'remote_addr' => '[[ip]]', 'http_via' => '', 'http_x_forwarded_for' => '', 'http_user_agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36', ), 'session_hosts' => array ( 'mydomain.com' => true, ), ), )
The output is the same regardless of whether I have an admin session running or not.
Thanks in advance!
A cookie set during a secure request won't be sent to the server during a non-secure request.
Investigate ways to ensure Cross Area Session always works (stash session IDs somewhere, "super session" id, etc.)
Redis is (likely) the next most popular session storage engine. The project should support it.
Also, I believe this will require adding a User.php class to the loader folder — if this is the caste User.php should also have a factory pattern applied so that multiple user level storage solutions (redit, memcache, etc.) are supportable.
What other session storage engines need support?
I want to get all logged in admin users from magento is it possible with this extension? How can i get that?
Finding a way to wrap all this is a test harness would be useful — but sessions session behavior on the command line is weird so I'm not sure the best way to go about this.
Add the usual package management debris to the repository.
Hi
Need Magento 2 Version of this module. I tried copying session file from vendor/magento/module-customer/Model/Session.php and changed the $this->_eventManager->dispatch('new_session_init', ['new_session' => $this]);
But its not working.
Do i need to initialize it before any preDispatch/Any Event?
Thank you
Sasikiran Kesavan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.