public function verify($action) { try { $this->provider = new OAuthProvider(); $this->provider->consumerHandler(array($this, 'lookupConsumer')); $this->provider->timestampNonceHandler(array($this, 'timestampNonceChecker')); $this->provider->tokenHandler(array($this, 'tokenHandler')); if ($action == "actionrequesttoken") { // No auth_token needed for this end point -- this is critical to get things working! $this->provider->setRequestTokenPath(dirname($_SERVER["PHP_SELF"])); } $this->provider->checkOAuthRequest(); } catch (OAuthException $E) { DTLog::warn("Could not complete OAuth request ({$action}):" . $E->getMessage()); return false; } switch ($action) { case "actionrequesttoken": $this->requestToken(); case "actionaccesstoken": $this->accessToken(); } return true; //@todo: this currently bypasses the requirement for consumer token--seems OK to me, since this is handled by OAuth }
public function verify($action) { try { if (parent::verify($action)) { //parent::verify has to happen first to set up userID! $user = new DTUser($this->db->filter(array("id" => $this->userID(), "is_admin" => 1))); return true; } } catch (Exception $e) { DTLog::warn("Failed attempt to access admin action '{$action}'."); return false; } return false; }
public function groupByName($name, $prefix = null) { $groups = $this->groupsList(0, $prefix); foreach ($groups as $itemKey => $group_version) { $g = $this->group($itemKey, $prefix); if ($g["name"] == $name) { $g["groupKey"] = $itemKey; //why did the dog wag his tail? return $g; } } DTLog::warn("Group ({$name}) not found!"); return null; }