示例#1
0
 /**
  * Enter description here...
  *
  * @param unknown_type $api_key
  * @param unknown_type $uid
  * @param unknown_type $ext_perm
  * @return unknown
  */
 public static function checkUserHasPermission($api_key, $uid, $ext_perm, $network_id)
 {
     $q = Doctrine_Query::create();
     if ($ext_perm == "status_update") {
         $q->select('allows_status_update');
     } else {
         if ($ext_perm == "photo_upload") {
             $q->select('allows_photo_upload');
         } else {
             if ($ext_perm == "create_listing") {
                 $q->select('allows_create_listing');
             } else {
                 throw new OpenFBAPIException("No such permission.", FB_ERROR_CODE_PARAMETER_MISSING);
             }
         }
     }
     $aid = Api_Dao_App::getAppIdByApiKey($api_key, $network_id);
     $q->from('RingsideUsersApp ua');
     $q->where("ua.app_id={$aid} AND ua.user_id = {$uid}");
     $perm = $q->execute();
     if (count($perm) > 0) {
         $ret = 0;
         if ($ext_perm == "status_update") {
             $ret = $perm[0]->allows_status_update;
         } else {
             if ($ext_perm == "photo_upload") {
                 $ret = $perm[0]->allows_photo_upload;
             } else {
                 if ($ext_perm == "create_listing") {
                     $ret = $perm[0]->allows_create_listing;
                 }
             }
         }
         if (intval($ret) > 0) {
             return true;
         }
     }
     return false;
 }
示例#2
0
文件: App.php 项目: jkinner/ringside
 /**
  * Enter description here...
  *
  * @param unknown_type $apiKey
  * @return unknown
  */
 public static function getAppIdByApiKey($apiKey, $networkId)
 {
     return Api_Dao_App::getAppIdByApiKey($apiKey, $networkId);
 }