-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing dependence upon hard-coded password in AutoPlaylist #109
Fixing dependence upon hard-coded password in AutoPlaylist #109
Conversation
…d to not require authentication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice fix to the login issue, can we get rid of the session completely or do other parts of the autodj code rely on it?
$autoPlaylists = static::_upcomingAutoPlaylistShows(); | ||
foreach ($autoPlaylists as $autoplaylist) { | ||
// Starting a session | ||
Zend_Session::start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the session is needed at all now that you don't login in a dummy user.
Application_Model_Preference::setAutoPlaylistPollLock(microtime(true)); | ||
Zend_Session::stop(); | ||
Application_Model_Preference::setAutoPlaylistPollLock(microtime(true)); | ||
Zend_Session::stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, no need to stop it if it isn't started in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My testing seems to indicate that the session is still necessary. When I comment out the start and stop session I get an authentication error again.
2017-03-22T03:23:05+00:00 INFO (6): localhost Scheduling 1
2017-03-22T03:23:05+00:00 ERR (3): localhost [ErrorController.php:26 - errorAction()] - You must explicitly start the session with Zend_Session::start() when session options are set to strict.
2017-03-22T03:23:05+00:00 ERR (3): localhost [ErrorController.php:27 - errorAction()] - #0 /vagrant/vendor/zendframework/zendframework1/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 /vagrant/vendor/zendframework/zendframework1/library/Zend/Auth/Storage/Session.php(86): Zend_Session_Namespace->__construct('Zend_Auth')
#2 /vagrant/vendor/zendframework/zendframework1/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct()
#3 /vagrant/airtime_mvc/application/models/User.php(377): Zend_Auth->getStorage()
#4 /vagrant/airtime_mvc/application/models/Scheduler.php(43): Application_Model_User::getCurrentUser()
#5 /vagrant/airtime_mvc/application/models/ShowInstance.php(232): Application_Model_Scheduler->__construct()
#6 /vagrant/airtime_mvc/application/common/AutoPlaylistManager.php(36): Application_Model_ShowInstance->addPlaylistToShow(1, false)
#7 /vagrant/airtime_mvc/application/common/TaskManager.php(248): AutoPlaylistManager::buildAutoPlaylist()
#8 /vagrant/airtime_mvc/application/common/TaskManager.php(61): AutoPlaylistTask->run()
#9 /vagrant/airtime_mvc/application/common/TaskManager.php(104): TaskManager->runTask('AutoPlaylistTas...')
#10 /vagrant/airtime_mvc/application/controllers/plugins/PageLayoutInitPlugin.php(73): TaskManager->runTasks()
#11 /vagrant/vendor/zendframework/zendframework1/library/Zend/Controller/Plugin/Broker.php(260): PageLayoutInitPlugin->routeShutdown(Object(Zend_Controller_Request_Http))
#12 /vagrant/vendor/zendframework/zendframework1/library/Zend/Controller/Front.php(923): Zend_Controller_Plugin_Broker->routeShutdown(Object(Zend_Controller_Request_Http))
#13 /vagrant/vendor/zendframework/zendframework1/library/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#14 /vagrant/vendor/zendframework/zendframework1/library/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#15 /vagrant/airtime_mvc/application/airtime-boot.php(84): Zend_Application->run()
#16 /vagrant/airtime_mvc/public/index.php(68): require_once('/vagrant/airtim...')
session still needed, i'll do some real testing b4 merging
It looks like this is the only reason It needs a login. I'll give making that optional a go. |
The user object was triggering the creation of a user context that tried to grab something from the session. The later code never tried to use this due to the checkPerm flag. I'm assuming the user model used to have a sane constructor w/o side effects in the times where this code had it's heyday.
I figured out how to get rid of the session. Let me know if it still works for you and I'll merge it. |
I tested it and it is working so I think we are ready to commit. Thanks for the help on the fix. |
The add playlistoshow function had a parameter that wasn't being utilized to allow it to tell the validation to not check the user permissions. The passing of this parameter was added back to the addPlaylistToShow function and this removed the dependence upon initializing a user object with the hardcoded admin password. This fixes #103