Skip to content
Permalink
Browse files

Always return response in redirect() for testing.

  • Loading branch information...
dereuromark committed Dec 23, 2015
1 parent 8343f6c commit 8b5ef12ccbc42b498ef580ab2bca566969fd7192
@@ -448,8 +448,8 @@ protected function _setDefaults() {
* Each adapter will be checked in sequence, if any of them return true, then the user will
* be authorized for the request.
*
* @param array $user The user to check the authorization of. If empty the user in the session will be used.
* @param CakeRequest $request The request to authenticate for. If empty, the current request will be used.
* @param array|null $user The user to check the authorization of. If empty the user in the session will be used.
* @param CakeRequest|null $request The request to authenticate for. If empty, the current request will be used.
* @return bool True if $user is authorized, otherwise false
*/
public function isAuthorized($user = null, CakeRequest $request = null) {
@@ -516,7 +516,7 @@ public function constructAuthorize() {
* `$this->Auth->allow('edit', 'add');` or
* `$this->Auth->allow();` to allow all actions
*
* @param string|array $action Controller action name or array of actions
* @param string|array|null $action Controller action name or array of actions
* @return void
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#making-actions-public
*/
@@ -541,7 +541,7 @@ public function allow($action = null) {
* `$this->Auth->deny('edit', 'add');` or
* `$this->Auth->deny();` to remove all items from the allowed list
*
* @param string|array $action Controller action name or array of actions
* @param string|array|null $action Controller action name or array of actions
* @return void
* @see AuthComponent::allow()
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#making-actions-require-authorization
@@ -572,7 +572,7 @@ public function deny($action = null) {
* attached authorize objects.
*
* @param array $map Actions to map
* @return void
* @return array
* @see BaseAuthorize::mapActions()
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#mapping-actions-when-using-crudauthorize
* @deprecated 3.0.0 Map actions using `actionMap` config key on authorize objects instead
@@ -588,6 +588,8 @@ public function mapActions($map = array()) {
if (empty($map)) {
return $mappedActions;
}
return [];
}
/**
@@ -598,7 +600,7 @@ public function mapActions($map = array()) {
* the user record is written to the session key specified in AuthComponent::$sessionKey. Logging in
* will also change the session id in order to help mitigate session replays.
*
* @param array $user Either an array of user data, or null to identify a user using the current request.
* @param array|null $user Either an array of user data, or null to identify a user using the current request.
* @return bool True on login success, false on failure
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in
*/
@@ -652,7 +654,7 @@ public function logout() {
* cache is primarily used for stateless authentication. For stateful authentication,
* cookies + sessions will be used.
*
* @param string $key field to retrieve. Leave null to get entire User record
* @param string|null $key field to retrieve. Leave null to get entire User record
* @return array|null User record. or null if no user is logged in.
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#accessing-the-logged-in-user
*/
@@ -674,7 +676,7 @@ public static function user($key = null) {
* Similar to AuthComponent::user() except if the session user cannot be found, connected authentication
* objects will have their getUser() methods called. This lets stateless authentication methods function correctly.
*
* @return bool true if a user can be found, false if one cannot.
* @return bool True if a user can be found, false if one cannot.
*/
protected function _getUser() {
$user = $this->user();
@@ -700,7 +702,7 @@ protected function _getUser() {
/**
* Backwards compatible alias for AuthComponent::redirectUrl().
*
* @param string|array $url Optional URL to write as the login redirect URL.
* @param string|array|null $url Optional URL to write as the login redirect URL.
* @return string Redirect URL
* @deprecated 3.0.0 Since 2.3.0, use AuthComponent::redirectUrl() instead
*/
@@ -723,7 +725,7 @@ public function redirect($url = null) {
* value is returned.
* - If there is no session and no $loginRedirect, / is returned.
*
* @param string|array $url Optional URL to write as the login redirect URL.
* @param string|array|null $url Optional URL to write as the login redirect URL.
* @return string Redirect URL
*/
public function redirectUrl($url = null) {
@@ -753,7 +753,7 @@ public function loadModel($modelClass = null, $id = null) {
* or an absolute URL
* @param int|array|null $status HTTP status code (eg: 301). Defaults to 302 when null is passed.
* @param bool $exit If true, exit() will be called after the redirect
* @return void
* @return \Cake\Network\Response|null
* @triggers Controller.beforeRedirect $this, array($url, $status, $exit)
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::redirect
*/
@@ -769,7 +769,7 @@ public function redirect($url, $status = null, $exit = true) {
$this->getEventManager()->dispatch($event);
if ($event->isStopped()) {
return;
return null;
}
$response = $event->result;
extract($this->_parseBeforeRedirect($response, $url, $status, $exit), EXTR_OVERWRITE);
@@ -794,6 +794,8 @@ public function redirect($url, $status = null, $exit = true) {
$this->response->send();
$this->_stop();
}
return $this->response;
}
/**
@@ -324,7 +324,7 @@ protected function _scaffoldDelete(CakeRequest $request) {
*
* @param string $message Message to display
* @param string $element Flash template to use
* @return void
* @return \Cake\Network\Response|null
*/
protected function _sendMessage($message, $element = 'default') {
if ($this->_validSession) {

0 comments on commit 8b5ef12

Please sign in to comment.
You can’t perform that action at this time.