Adding AuthComponent::user() to return current user, fixing config/paths docblocks, and adding IMAGES path

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4322 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-01-23 16:27:34 +00:00
parent 6c670400ca
commit 685054fac3
2 changed files with 18 additions and 2 deletions

View file

@ -93,13 +93,17 @@
*/
define ('LIBS', CAKE.'libs'.DS);
/**
* Path to the public directory.
* Path to the public CSS directory.
*/
define ('CSS', WWW_ROOT.'css'.DS);
/**
* Path to the public directory.
* Path to the public JavaScript directory.
*/
define ('JS', WWW_ROOT.'js'.DS);
/**
* Path to the public images directory.
*/
define ('IMAGES', WWW_ROOT.'img'.DS);
/**
* Path to the scripts direcotry.
*/

View file

@ -315,6 +315,18 @@ class AuthComponent extends Object {
}
return $this->_loggedIn;
}
/**
* Get the current user from the session.
*
* @access public
* @return array User record, or null if no user is logged in.
*/
function user() {
if (!$this->Session->check($this->sessionKey)) {
return null;
}
return array($this->userModel => $this->Session->read($this->sessionKey));
}
/**
* Gets the authentication redirect URL
*