Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

user_auth.php

Go to the documentation of this file.
00001 
00002 /** @file user_auth.php
00003 * Definition of class user_auth.
00004 */
00005 #include "xml_event_parser_user.php"
00006 /**
00007 * User authentification.
00008 * This class checks authentification information and provides information
00009 * about successfully authentificated user.
00010 * @todo Provide more secure authentification method.
00011 * @note By now passwords are NOT crypted.
00012 */
00013 class user_auth : public  xml_event_parser_user
00014 {
00015 public:
00016   /** User name. */
00017   var name = '';
00018   /** User password. */
00019   var password = '';
00020   /** User`s full name. */
00021   var fullname = '';
00022   /** User`s skills. */
00023   var skills = array();
00024   var user_found = 0;
00025   var import_skills = 0;
00026   /**
00027   * Check authentification information.
00028   * @param string users_location - location of users definition
00029   * @param string name - user`s name
00030   * @param string password
00031   * @return nonzero if authentification is ok
00032   */
00033   function authentificate( users_location, name, password )
00034   {
00035     if( users_location == '' )
00036       return this->err( 'Users definition location is not set', 'authentificate', __LINE__, __FILE__ );
00037     this->name = name;
00038     this->import( users_location );
00039     if( !this->user_found )
00040       return 0;
00041     pswd = this->password;
00042     unset( this->password );
00043     return ( pswd == password );
00044   }
00045   /**
00046   * Return user`s fullname.
00047   */
00048   function get_fullname()
00049   {
00050     return this->fullname;
00051   }
00052   /**
00053   * Return user`s skills.
00054   */
00055   function get_skills()
00056   {
00057     return this->skills;
00058   }
00059   /**
00060   * @todo Add crypting.
00061   */
00062   function xep_open_users_user( attributes )
00063   {
00064     if( attributes[ 'name' ] == this->name )
00065     {
00066       this->user_found = 1;
00067       this->import_skills = 1;
00068       this->password = attributes[ 'password' ];
00069       this->fullname = attributes[ 'fullname' ];
00070     }
00071   }
00072 
00073   function xep_close_users_user()
00074   {
00075     this->import_skills = 0;
00076   }
00077 
00078   function xep_open_users_user_skills_skill( attributes )
00079   {
00080     if( this->import_skills )
00081       this->skills[] = attributes[ 'id' ];
00082   }
00083 }
00084 X-Powered-By: PHP/4.0.8-dev
00085 Content-type: text/html
00086 
00087 

Generated on Tue Mar 11 08:35:13 2003 for SES by doxygen1.2.16