/** * 管理者用媒体CHK認証処理を行う。 * * @param integer $id ユーザーID * @param string $password パスワード * @return boolean 認証成功ならtrue、失敗ならfalse */ public function baitaiAgencyAdminAuthentication($id = null, $password = null) { // カレントユーザーが認証済みか? if (!$this->_authOBJ->hasIdentity()) { if (!$id or !$password) { return FALSE; } $passwordKey = AdmBaitaiAgency::createPasswordKey($password); $adapter = new ComAuthAdapterDbTable($this->getDbObject(), "baitai_agency_admin", "login_id", "password"); $adapter->setIdentity($id)->setCredential($passwordKey); $select = $adapter->getDbSelect(); $select->where("disable = 0"); /* // IPアドレスあればチェック if ($ipAddress) { $select->where("ip_address = '" . $ipAddress . "'"); } */ $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; } }