mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #594 from tigrang/auth-ext
Added `contain` option to AuthComponent's Authentication objects
This commit is contained in:
commit
37d235fa16
3 changed files with 14 additions and 4 deletions
|
@ -30,6 +30,7 @@ abstract class BaseAuthenticate {
|
||||||
* - `scope` Additional conditions to use when looking up and authenticating users,
|
* - `scope` Additional conditions to use when looking up and authenticating users,
|
||||||
* i.e. `array('User.is_active' => 1).`
|
* i.e. `array('User.is_active' => 1).`
|
||||||
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
|
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
|
||||||
|
* - `contain` Extra models to contain and store in session.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +41,8 @@ abstract class BaseAuthenticate {
|
||||||
),
|
),
|
||||||
'userModel' => 'User',
|
'userModel' => 'User',
|
||||||
'scope' => array(),
|
'scope' => array(),
|
||||||
'recursive' => 0
|
'recursive' => 0,
|
||||||
|
'contain' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,13 +84,16 @@ abstract class BaseAuthenticate {
|
||||||
}
|
}
|
||||||
$result = ClassRegistry::init($userModel)->find('first', array(
|
$result = ClassRegistry::init($userModel)->find('first', array(
|
||||||
'conditions' => $conditions,
|
'conditions' => $conditions,
|
||||||
'recursive' => (int)$this->settings['recursive']
|
'recursive' => (int)$this->settings['recursive'],
|
||||||
|
'contain' => $this->settings['contain'],
|
||||||
));
|
));
|
||||||
if (empty($result) || empty($result[$model])) {
|
if (empty($result) || empty($result[$model])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unset($result[$model][$fields['password']]);
|
$user = $result[$model];
|
||||||
return $result[$model];
|
unset($user[$fields['password']]);
|
||||||
|
unset($result[$model]);
|
||||||
|
return array_merge($user, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,6 +50,7 @@ class BasicAuthenticate extends BaseAuthenticate {
|
||||||
* - `scope` Additional conditions to use when looking up and authenticating users,
|
* - `scope` Additional conditions to use when looking up and authenticating users,
|
||||||
* i.e. `array('User.is_active' => 1).`
|
* i.e. `array('User.is_active' => 1).`
|
||||||
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
|
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
|
||||||
|
* - `contain` Extra models to contain and store in session.
|
||||||
* - `realm` The realm authentication is for. Defaults the server name.
|
* - `realm` The realm authentication is for. Defaults the server name.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -62,6 +63,7 @@ class BasicAuthenticate extends BaseAuthenticate {
|
||||||
'userModel' => 'User',
|
'userModel' => 'User',
|
||||||
'scope' => array(),
|
'scope' => array(),
|
||||||
'recursive' => 0,
|
'recursive' => 0,
|
||||||
|
'contain' => null,
|
||||||
'realm' => '',
|
'realm' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ class DigestAuthenticate extends BaseAuthenticate {
|
||||||
* - `userModel` The model name of the User, defaults to User.
|
* - `userModel` The model name of the User, defaults to User.
|
||||||
* - `scope` Additional conditions to use when looking up and authenticating users,
|
* - `scope` Additional conditions to use when looking up and authenticating users,
|
||||||
* i.e. `array('User.is_active' => 1).`
|
* i.e. `array('User.is_active' => 1).`
|
||||||
|
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
|
||||||
|
* - `contain` Extra models to contain and store in session.
|
||||||
* - `realm` The realm authentication is for, Defaults to the servername.
|
* - `realm` The realm authentication is for, Defaults to the servername.
|
||||||
* - `nonce` A nonce used for authentication. Defaults to `uniqid()`.
|
* - `nonce` A nonce used for authentication. Defaults to `uniqid()`.
|
||||||
* - `qop` Defaults to auth, no other values are supported at this time.
|
* - `qop` Defaults to auth, no other values are supported at this time.
|
||||||
|
@ -79,6 +81,7 @@ class DigestAuthenticate extends BaseAuthenticate {
|
||||||
'userModel' => 'User',
|
'userModel' => 'User',
|
||||||
'scope' => array(),
|
'scope' => array(),
|
||||||
'recursive' => 0,
|
'recursive' => 0,
|
||||||
|
'contain' => null,
|
||||||
'realm' => '',
|
'realm' => '',
|
||||||
'qop' => 'auth',
|
'qop' => 'auth',
|
||||||
'nonce' => '',
|
'nonce' => '',
|
||||||
|
|
Loading…
Reference in a new issue