mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #7903 from cakephp/2.8-return-reponse
Always return response in redirect() for testing.
This commit is contained in:
commit
bca3064df2
3 changed files with 17 additions and 13 deletions
|
@ -448,8 +448,8 @@ class AuthComponent extends Component {
|
|||
* 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 @@ class AuthComponent extends Component {
|
|||
* `$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 @@ class AuthComponent extends Component {
|
|||
* `$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 @@ class AuthComponent extends Component {
|
|||
* 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 @@ class AuthComponent extends Component {
|
|||
if (empty($map)) {
|
||||
return $mappedActions;
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -598,7 +600,7 @@ class AuthComponent extends Component {
|
|||
* 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 @@ class AuthComponent extends Component {
|
|||
* 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 @@ class AuthComponent extends Component {
|
|||
* 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 @@ class AuthComponent extends Component {
|
|||
/**
|
||||
* 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 @@ class AuthComponent extends Component {
|
|||
* 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 @@ class Controller extends Object implements CakeEventListener {
|
|||
* 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 @@ class Controller extends Object implements CakeEventListener {
|
|||
$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 @@ class Controller extends Object implements CakeEventListener {
|
|||
$this->response->send();
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -324,7 +324,7 @@ class Scaffold {
|
|||
*
|
||||
* @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) {
|
||||
|
|
Loading…
Reference in a new issue