Exemple #1
0
 /**
  * 媒体CHK認証処理を行う。
  *
  * @param  integer $id ユーザーID
  * @param  string $password パスワード
  * @return boolean 認証成功ならtrue、失敗ならfalse
  */
 public function baitaiAuthentication($id = null, $password = null)
 {
     // カレントユーザーが認証済みか?
     if (!$this->_authOBJ->hasIdentity()) {
         if (!$id or !$password) {
             return FALSE;
         }
         $passwordKey = AdmBaitai::createPasswordKey($password);
         $adapter = new ComAuthAdapterDbTable($this->getDbObject(), "baitai_admin", "login_id", "password");
         $adapter->setIdentity($id)->setCredential($passwordKey);
         $select = $adapter->getDbSelect();
         $select->where("disable = 0");
         $select->limit(1);
         // 認証処理を実行
         $result = $this->_authOBJ->authenticate($adapter);
         if (!$result->isValid()) {
             return FALSE;
         } else {
             // 必要な情報をセッションに登録
             $this->_authOBJ->getStorage()->write($adapter->getResultRowObject(NULL, array("password", "disable")));
             return TRUE;
         }
         // 認証済み
     } else {
         return TRUE;
     }
 }