From b93b6514cc79c322facac9b4e4db67b01241e82c Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 1 Oct 2007 01:01:16 +0000 Subject: fixed demos due to change in IUserManager. --- demos/blog/protected/Common/BlogUserManager.php | 22 +++++++++++++++++ demos/chat/protected/App_Code/ChatUserManager.php | 28 +++++++++++++++++++--- .../protected/App_Code/UserManager.php | 26 ++++++++++++++++++-- 3 files changed, 71 insertions(+), 5 deletions(-) (limited to 'demos') diff --git a/demos/blog/protected/Common/BlogUserManager.php b/demos/blog/protected/Common/BlogUserManager.php index a3053c61..5d1007cf 100644 --- a/demos/blog/protected/Common/BlogUserManager.php +++ b/demos/blog/protected/Common/BlogUserManager.php @@ -68,6 +68,28 @@ class BlogUserManager extends TModule implements IUserManager else return false; } + + /** + * Saves user auth data into a cookie. + * @param THttpCookie the cookie to receive the user auth data. + * @since 3.1.1 + */ + public function saveUserToCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + } + + /** + * Validates if the username and password are correct. + * @param string user name + * @param string password + * @return boolean true if validation is successful, false otherwise. + */ + public function validateUser($username,$password) + { + // do nothing since we don't support cookie-based auth in this example + return false; + } } ?> \ No newline at end of file diff --git a/demos/chat/protected/App_Code/ChatUserManager.php b/demos/chat/protected/App_Code/ChatUserManager.php index f8fe09cc..495a151d 100644 --- a/demos/chat/protected/App_Code/ChatUserManager.php +++ b/demos/chat/protected/App_Code/ChatUserManager.php @@ -9,7 +9,7 @@ class ChatUserManager extends TModule implements IUserManager { return 'Guest'; } - + /** * Returns a user instance given the user name. * @param string user name, null if it is a guest. @@ -18,7 +18,7 @@ class ChatUserManager extends TModule implements IUserManager public function getUser($username=null) { $user=new TUser($this); - $user->setIsGuest(true); + $user->setIsGuest(true); if($username !== null) { $user->setIsGuest(false); @@ -27,7 +27,7 @@ class ChatUserManager extends TModule implements IUserManager } return $user; } - + /** * Add a new user to the database. * @param string username. @@ -57,6 +57,28 @@ class ChatUserManager extends TModule implements IUserManager { return $this->usernameExists($username); } + + /** + * Saves user auth data into a cookie. + * @param THttpCookie the cookie to receive the user auth data. + * @since 3.1.1 + */ + public function saveUserToCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + } + + /** + * Validates if the username and password are correct. + * @param string user name + * @param string password + * @return boolean true if validation is successful, false otherwise. + */ + public function validateUser($username,$password) + { + // do nothing since we don't support cookie-based auth in this example + return false; + } } diff --git a/demos/time-tracker/protected/App_Code/UserManager.php b/demos/time-tracker/protected/App_Code/UserManager.php index b4a4ad68..4d4ce75c 100644 --- a/demos/time-tracker/protected/App_Code/UserManager.php +++ b/demos/time-tracker/protected/App_Code/UserManager.php @@ -27,7 +27,7 @@ class UserManager extends TModule implements IUserManager { return 'Guest'; } - + /** * Returns a user instance given the user name. * @param string user name, null if it is a guest. @@ -50,7 +50,7 @@ class UserManager extends TModule implements IUserManager return $user; } } - + /** * Validates if the username and password are correct. * @param string user name @@ -63,6 +63,28 @@ class UserManager extends TModule implements IUserManager $userDao = $daos->getDao('UserDao'); return $userDao->validateUser($username, $password); } + + /** + * Saves user auth data into a cookie. + * @param THttpCookie the cookie to receive the user auth data. + * @since 3.1.1 + */ + public function saveUserToCookie($cookie) + { + // do nothing since we don't support cookie-based auth in this example + } + + /** + * Validates if the username and password are correct. + * @param string user name + * @param string password + * @return boolean true if validation is successful, false otherwise. + */ + public function validateUser($username,$password) + { + // do nothing since we don't support cookie-based auth in this example + return false; + } } ?> \ No newline at end of file -- cgit v1.2.3