I have common login table for admin, manager, sales engineer ie(role=>1=admin,2=manager,3=sales engineer) i have three modules i want to allow manager to perform login in manager module and admin to admin model and so… how should i perform this i followed the bellow code im able to restrict user but i unable to show the specified error ie(Your not allowed to perform this login) , thanks in advance
if ($user === null)
{
$this->errorCode = self::ERROR_USERNAME_INVALID;
}
else if (md5(trim($this->password)) !== trim($user->password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
else if($user->role!=2)
{
$this->errorCode='Your not allowed to perform this login';
}
{
$this->_identity=new UserIdentity($this->username,$this->password);
if(!$this->_identity->authenticate())
$this->addError('password','Incorrect username or password.');
if($this->_identity->errorCode===UserIdentity::ERROR_USER_TYPE)
{
$this->addError('username','You are not a valid user!');
}
}