Beispiel #1
0
 function getConfiguration($provider)
 {
     $db = new dbConnection();
     $res = $db->do_query("CALL getOAuthProvider('{$provider}')");
     if ($res) {
         $this->provider = $provider;
         $p = $db->get_row_object();
         $this->configuration['callbackUrl'] = "http://" . $_SERVER["HTTP_HOST"] . $p->callbackUrl;
         $this->configuration['requestTokenUrl'] = $p->requestTokenUrl;
         $this->configuration['authorizeUrl'] = $p->authorizeUrl;
         $this->configuration['accessTokenUrl'] = $p->accessTokenUrl;
         $this->configuration['consumerKey'] = $p->consumerKey;
         $this->configuration['consumerSecret'] = $p->consumerSecret;
         $this->providerFriendlyName = $p->friendlyNameVar;
         $this->providerIcon = $p->providerIcon;
     } else {
         //log/throw error
         $err = new OAuthException();
         $err->error = 404;
         $err->message = "Provider \"{$provider}\" is not available for use with EpiCollect";
         throw $err;
     }
 }
Beispiel #2
0
 public function checkPermission($uid)
 {
     $db = new dbConnection();
     $res = $db->exec_sp("checkProjectPermission", array($uid ? $uid : 0, $this->id));
     if ($res !== true) {
         echo $res;
     }
     $obj = $db->get_row_object();
     return $obj ? $obj->role : $this->isPublic;
 }