Skip to content
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

Merged
merged 2 commits into from
Mar 23, 2017

Conversation

Robbt
Copy link
Member

@Robbt Robbt commented Mar 21, 2017

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

Copy link
Member

@hairmare hairmare left a 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();
Copy link
Member

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();
Copy link
Member

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.

Copy link
Member Author

@Robbt Robbt Mar 22, 2017

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...')

@hairmare hairmare dismissed their stale review March 22, 2017 06:49

session still needed, i'll do some real testing b4 merging

@hairmare
Copy link
Member

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.
@hairmare
Copy link
Member

I figured out how to get rid of the session. Let me know if it still works for you and I'll merge it.

@Robbt
Copy link
Member Author

Robbt commented Mar 22, 2017

I tested it and it is working so I think we are ready to commit. Thanks for the help on the fix.

@hairmare hairmare merged commit 01aef51 into libretime:master Mar 23, 2017
@hairmare hairmare modified the milestone: 3.0.0-alpha.1 Mar 23, 2017
@lock
Copy link

lock bot commented Oct 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please chat to us on discourse or ask for help on our chat if you have any questions or need further assistance with this issue.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: Changing the admin's password causes the auto playlist function to fail.
2 participants