예제 #1
0
 public function getMember()
 {
     if (!is_null($this->member)) {
         return $this->member;
     }
     $request = sfContext::getInstance()->getRequest();
     $apiKey = $request['apiKey'];
     if (false === $apiKey) {
         $exception = new opErrorHttpException('apiKey parameter not specified.');
         throw $exception->setHttpStatusCode(401);
     }
     $member = $this->getMemberByApiKey($apiKey);
     if (is_null($member) || $member->isOnBlackList() || $member->getIsLoginRejected()) {
         $exception = new opErrorHttpException('Invalid API key.');
         throw $exception->setHttpStatusCode(401);
     }
     $this->member = $member;
     return $member;
 }
예제 #2
0
 public function forward403($message = null)
 {
     $exception = new opErrorHttpException($message);
     throw $exception->setHttpStatusCode(403);
 }