استفاده از چند Login

[rtl][right][font="Tahoma"]

من در پروژه ام احتیاج به استفاده از چند Login رو دارم ولی در Yii نمیشه این کارو انجام داد !

باید سیستم Login خودم بنویسم ؟

یک لاگین در user یک لاگین در admin

[/font][/right][/rtl]

[rtl][right]

[font="Tahoma"]

من یک سیستم دانشگاه دارم که در این سیستم فقط دانشجو ها باید login کنند و یک سیستم ادمین دارم که هر کدام یک فرم لاگین جدا دارند .

الان تو دو تا سیستم AccessRules گذاشتم که AccessRules ادمین درست کار نمی کنه میرفسته به لاگین یوزر

[/font][/right][/rtl]

:huh:

بهتره کدهای اون قسمت رو بذارید .

controller site




 public function filters()

	{

		return array(

			'accessControl', // perform access control for CRUD operations

		);

	}

    

    public function accessRules()

	{

		return array(

			array('allow',  // allow all users to perform 'index' and 'view' actions

				'controllers' => array('site'),

                'actions'=>array('index','print','Card', 'WeeklySchedule', 'WorkBook', 'Car',  'Tuition', 'TuitionUnit', 'CreateUnit', 'ChangePass', 'LessonReshte', 'DetailStudent'),

				'users'=>array('@'),

			),

			array('deny',  // deny all users

				'users'=>array('*'),

			),

		);

	}



congif


'user'=>array(

           

            'loginUrl' => array('user/login'),

			'returnUrl' => array('site/index'),

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

            'stateKeyPrefix' => 'Site',

		),

cntroller admin


  public function filters()

	{

		return array(

			'accessControl', // perform access control for CRUD operations

		);

	}

    

    public function accessRules()

	{

		return array(

			array('allow',  // allow all users to perform 'index' and 'view' actions

				'controllers' => array('site'),

                'actions'=>array('index'),

				'users'=>array('@'),

			),

			array('deny',  // deny all users

				'users'=>array('*'),

			),

		);

	}

config


 'admin'=>array(

         

            'loginUrl' => array('Admin/Login'),

            'stateKeyPrefix' => 'Admin' ,

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

component cwebuser




class UserIdentity extends CUserIdentity

{

	private $_id;


	public function authenticate()

	{

		$user=User::model()->find('LOWER(number_student)=? AND active = 1',array(strtolower($this->username)));

		if($user===null)

			$this->errorCode=self::ERROR_USERNAME_INVALID;

		else if(!$user->validatePassword($this->password))

			$this->errorCode=self::ERROR_PASSWORD_INVALID;

		else

		{

			$this->_id=$user->id;

			$this->username=$user->number_student;

            $this->setState('status', $user->status);

		

			$this->errorCode=self::ERROR_NONE;

		}

		return $this->errorCode==self::ERROR_NONE;

	}


	public function getId()

	{

		return $this->_id;

	}

}