Skip to main content

Posts

Showing posts from May 3, 2014

Yii Authentication and Authorization Login logout Access control filter and User Types

Authentication and Authorization check if a user is logged in or not via CWebUser::isGuest check if the user can perform specific operations by calling CWebUser::checkAccess  The main work in defining an identity class is the implementation of the IUserIdentity::authenticate method  class UserIdentity extends CUserIdentity {     private $_id;     public function authenticate()     {         $record=User::model()->findByAttributes(array('username'=>$this->username));         if($record===null)             $this->errorCode=self::ERROR_USERNAME_INVALID;         else if($record->password!==crypt($this->password,$record->password))             $this->errorCode=self::ERROR_PASSWORD_INVALID;         else         {             ...