Merge pull request #738 from zpencerq/authcomponentproblem

Auth Component can't return false from user($key)
This commit is contained in:
Mark Story 2012-07-25 16:05:29 -07:00
commit b99be9878a
2 changed files with 5 additions and 4 deletions

View file

@ -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);
}
/**

View file

@ -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);
}
}