Пример #1
0
 /**
  * 認証処理を行う。
  *
  * @param  integer $id ユーザーID
  * @param  string $password パスワード
  * @return boolean 認証成功ならtrue、失敗ならfalse
  */
 public function authentication($id = null, $password = null)
 {
     // カレントユーザーが認証済みか?
     if (!$this->_authOBJ->hasIdentity()) {
         if (!$id or !$password) {
             return FALSE;
         }
         $adapter = new ComAuthAdapterDbTable($this->getDbObject(), "v_user_profile", "login_id", "password");
         $adapter->setIdentity($id)->setCredential($password);
         $select = $adapter->getDbSelect();
         $select->where("user_disable = 0");
         $select->where("regist_status NOT IN (" . $this->_configOBJ->define->USER_REGIST_STATUS_MEMBER_QUIT . ")");
         $select->where("danger_status = 0");
         $select->limit(1);
         // 認証処理を実行
         $result = $this->_authOBJ->authenticate($adapter);
         if (!$result->isValid()) {
             return FALSE;
         } else {
             // 必要な情報をセッションに登録
             $this->_authOBJ->getStorage()->write($adapter->getResultRowObject(NULL, array("password", "user_disable")));
             return TRUE;
         }
         // 認証済み
     } else {
         return TRUE;
     }
 }
Пример #2
0
 /**
  * インスタンスの取得。
  *
  * インスタンスが既に生成済みの場合は既存インスタンスを返し、
  * 未生成であれば新たに生成したものを返す。
  *
  * @param  $dbOBJ DBオブジェクト
  * @param  $tableName テーブル名
  * @param  $identityColumn ユーザー名
  * @param  $credentialColumn パスワード
  * @param  $credentialTreatment 暗号化する式(md5(?)など)
  *
  * @return mixed 成功時はインスタンス、失敗時はfalseを返す
  */
 public static function getInstance($dbOBJ, $tableName = null, $identityColumn = null, $credentialColumn = null, $credentialTreatment = null)
 {
     if (null === self::$_instance) {
         self::$_instance = new self($dbOBJ, $tableName, $identityColumn, $credentialColumn, $credentialTreatment);
     }
     return self::$_instance;
 }
Пример #3
0
 /**
  * 管理者用媒体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;
     }
 }