Backport ACL REST permission fix
This commit is contained in:
parent
4b6e5671c3
commit
2a9790adf3
|
@ -48,7 +48,8 @@ $ccAcl->allow('G', 'index')
|
||||||
->allow('G', 'locale')
|
->allow('G', 'locale')
|
||||||
->allow('G', 'upgrade')
|
->allow('G', 'upgrade')
|
||||||
->allow('G', 'downgrade')
|
->allow('G', 'downgrade')
|
||||||
->allow('G', 'rest:media')
|
->allow('G', 'rest:media', 'get')
|
||||||
|
->allow('H', 'rest:media')
|
||||||
->allow('H', 'preference', 'is-import-in-progress')
|
->allow('H', 'preference', 'is-import-in-progress')
|
||||||
->allow('H', 'usersettings')
|
->allow('H', 'usersettings')
|
||||||
->allow('H', 'plupload')
|
->allow('H', 'plupload')
|
||||||
|
|
|
@ -123,28 +123,32 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else //Non-REST, regular Airtime web app requests
|
||||||
|
{
|
||||||
|
//Redirect you to the login screen since you have no session.
|
||||||
|
if ($controller !== 'login') {
|
||||||
|
|
||||||
if ($controller !== 'login') {
|
if ($request->isXmlHttpRequest()) {
|
||||||
|
|
||||||
if ($request->isXmlHttpRequest()) {
|
$url = 'http://'.$request->getHttpHost().'/login';
|
||||||
|
$json = Zend_Json::encode(array('auth' => false, 'url' => $url));
|
||||||
|
|
||||||
$url = 'http://'.$request->getHttpHost().'/login';
|
// Prepare response
|
||||||
$json = Zend_Json::encode(array('auth' => false, 'url' => $url));
|
$this->getResponse()
|
||||||
|
->setHttpResponseCode(401)
|
||||||
|
->setBody($json)
|
||||||
|
->sendResponse();
|
||||||
|
|
||||||
// Prepare response
|
//redirectAndExit() cleans up, sends the headers and stops the script
|
||||||
$this->getResponse()
|
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit();
|
||||||
->setHttpResponseCode(401)
|
} else {
|
||||||
->setBody($json)
|
$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
|
||||||
->sendResponse();
|
$r->gotoSimpleAndExit('index', 'login', $request->getModuleName());
|
||||||
|
}
|
||||||
//redirectAndExit() cleans up, sends the headers and stops the script
|
}
|
||||||
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->redirectAndExit();
|
|
||||||
} else {
|
|
||||||
$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
|
|
||||||
$r->gotoSimpleAndExit('index', 'login', $request->getModuleName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else { //We have a session/identity.
|
||||||
|
|
||||||
// If we have an identity and we're making a RESTful request,
|
// If we have an identity and we're making a RESTful request,
|
||||||
// we need to check the CSRF token
|
// we need to check the CSRF token
|
||||||
if ($request->_action != "get" && $request->getModuleName() == "rest") {
|
if ($request->_action != "get" && $request->getModuleName() == "rest") {
|
||||||
|
|
Loading…
Reference in New Issue