mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +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) {
|
if ($key === null) {
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
if ($value = Hash::get($user, $key)) {
|
return Hash::get($user, $key);
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1269,6 +1269,7 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
'id' => '1',
|
'id' => '1',
|
||||||
'name' => 'Members'
|
'name' => 'Members'
|
||||||
),
|
),
|
||||||
|
'is_admin' => false,
|
||||||
));
|
));
|
||||||
$this->Auth->Session->write('Auth', $data);
|
$this->Auth->Session->write('Auth', $data);
|
||||||
|
|
||||||
|
@ -1286,5 +1287,8 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Auth->user('Company.invalid');
|
$result = $this->Auth->user('Company.invalid');
|
||||||
$this->assertEquals(null, $result);
|
$this->assertEquals(null, $result);
|
||||||
|
|
||||||
|
$result = $this->Auth->user('is_admin');
|
||||||
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue