mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge pull request #738 from zpencerq/authcomponentproblem
Auth Component can't return false from user($key)
This commit is contained in:
commit
b99be9878a
2 changed files with 5 additions and 4 deletions
|
@ -565,10 +565,7 @@ class AuthComponent extends Component {
|
|||
if ($key === null) {
|
||||
return $user;
|
||||
}
|
||||
if ($value = Hash::get($user, $key)) {
|
||||
return $value;
|
||||
}
|
||||
return null;
|
||||
return Hash::get($user, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1269,6 +1269,7 @@ class AuthComponentTest extends CakeTestCase {
|
|||
'id' => '1',
|
||||
'name' => 'Members'
|
||||
),
|
||||
'is_admin' => false,
|
||||
));
|
||||
$this->Auth->Session->write('Auth', $data);
|
||||
|
||||
|
@ -1286,5 +1287,8 @@ class AuthComponentTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Auth->user('Company.invalid');
|
||||
$this->assertEquals(null, $result);
|
||||
|
||||
$result = $this->Auth->user('is_admin');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue