summaryrefslogtreecommitdiff
path: root/demos/blog-tutorial/protected/pages/Day3/Auth.page
diff options
context:
space:
mode:
authorwei <>2007-05-10 23:00:04 +0000
committerwei <>2007-05-10 23:00:04 +0000
commite2cb0b52aaa02a3f3f41d0df377d189529713738 (patch)
treeee4c2a3fece40c9a2d4dde75f6e758f7ef05f8f6 /demos/blog-tutorial/protected/pages/Day3/Auth.page
parentef2fc3942664d4d7131542080e838f7754a3081f (diff)
Update blog tutorial
Diffstat (limited to 'demos/blog-tutorial/protected/pages/Day3/Auth.page')
-rw-r--r--demos/blog-tutorial/protected/pages/Day3/Auth.page84
1 files changed, 42 insertions, 42 deletions
diff --git a/demos/blog-tutorial/protected/pages/Day3/Auth.page b/demos/blog-tutorial/protected/pages/Day3/Auth.page
index 82c667d7..8d066b24 100644
--- a/demos/blog-tutorial/protected/pages/Day3/Auth.page
+++ b/demos/blog-tutorial/protected/pages/Day3/Auth.page
@@ -52,50 +52,50 @@ Prado::using('System.Security.TDbUserManager');
*/
class BlogUser extends TDbUser
{
- /**
- * Creates a BlogUser object based on the specified username.
- * This method is required by TDbUser. It checks the database
- * to see if the specified username is there. If so, a BlogUser
- * object is created and initialized.
- * @param string the specified username
- * @return BlogUser the user object, null if username is invalid.
- */
- public function createUser($username)
- {
- // use UserRecord Active Record to look for the specified username
- $userRecord=UserRecord::finder()->findByPk($username);
- if($userRecord instanceof UserRecord) // if found
- {
- $user=new BlogUser($this->Manager);
- $user->Name=$username; // set username
- $user->Roles=($userRecord->role==1?'admin':'user'); // set role
- $user->IsGuest=false; // the user is not a guest
- return $user;
- }
- else
- return null;
- }
+ /**
+ * Creates a BlogUser object based on the specified username.
+ * This method is required by TDbUser. It checks the database
+ * to see if the specified username is there. If so, a BlogUser
+ * object is created and initialized.
+ * @param string the specified username
+ * @return BlogUser the user object, null if username is invalid.
+ */
+ public function createUser($username)
+ {
+ // use UserRecord Active Record to look for the specified username
+ $userRecord=UserRecord::finder()->findByPk($username);
+ if($userRecord instanceof UserRecord) // if found
+ {
+ $user=new BlogUser($this->Manager);
+ $user->Name=$username; // set username
+ $user->Roles=($userRecord->role==1?'admin':'user'); // set role
+ $user->IsGuest=false; // the user is not a guest
+ return $user;
+ }
+ else
+ return null;
+ }
- /**
- * Checks if the specified (username, password) is valid.
- * This method is required by TDbUser.
- * @param string username
- * @param string password
- * @return boolean whether the username and password are valid.
- */
- public function validateUser($username,$password)
- {
- // use UserRecord Active Record to look for the (username, password) pair.
- return UserRecord::finder()->findBy_username_AND_password($username,$password)!==null;
- }
+ /**
+ * Checks if the specified (username, password) is valid.
+ * This method is required by TDbUser.
+ * @param string username
+ * @param string password
+ * @return boolean whether the username and password are valid.
+ */
+ public function validateUser($username,$password)
+ {
+ // use UserRecord Active Record to look for the (username, password) pair.
+ return UserRecord::finder()->findBy_username_AND_password($username,$password)!==null;
+ }
- /**
- * @return boolean whether this user is an administrator.
- */
- public function getIsAdmin()
- {
- return $this->isInRole('admin');
- }
+ /**
+ * @return boolean whether this user is an administrator.
+ */
+ public function getIsAdmin()
+ {
+ return $this->isInRole('admin');
+ }
}
</com:TTextHighlighter>