Last active
August 29, 2015 14:00
-
-
Save jokosusilo/f08f15346d7636437d01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* UserIdentity represents the data needed to identity a user. | |
* It contains the authentication method that checks if the provided | |
* data can identity the user. | |
*/ | |
class UserIdentity extends CUserIdentity | |
{ | |
private $id; | |
public function authenticate() { | |
$record = MsUser::model()->findByAttributes(array('kode_skpd' => $this->username)); | |
if ($record === null) | |
$this->errorCode = self::ERROR_USERNAME_INVALID; | |
else if ($record->password !== $this->password) | |
$this->errorCode = self::ERROR_PASSWORD_INVALID; | |
else { | |
$this->id = $record->id; | |
$this->setState('roles', $record->hakakses); | |
$this->errorCode = self::ERROR_NONE; | |
} | |
return !$this->errorCode; | |
} | |
public function getId() { | |
return $this->id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment