<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class overrides Kohana's Auth so that we can login to TSM
 *
 * @package    PTA
 * @subpackage Auth
 * @category   Overrides
 * @author     Deon George
 * @copyright  (c) 2010 phpTSMadmin Development Team
 * @license    http://phptsmadmin.sf.net/license.html
 */
class Auth_ORM extends Kohana_Auth_ORM {
	/**
	 * Attempt to log in a user by using an ORM object and plain-text password.
	 *
	 * @param   string   username to log in
	 * @param   string   password to check against
	 * @param   boolean  enable autologin
	 * @return  boolean
	 */
	public function login($username, $password, $remember = FALSE) {
		// With TSM, if we get this far, we are logged in
		return $username->loaded();
	}

	public function logged_in($role = NULL, $all_required = TRUE) {
		return FALSE !== $this->get_user();
	}
}
?>
