Esempio n. 1
0
 /**
  * Execute the users.hasAppPermission method
  *  
  */
 public function execute()
 {
     $ret = Api_Bo_Users::setStatus($this->getUserId(), $this->getAppId(), $this->getSessionValue('api_key'), $this->getNetworkId(), $this->m_status, $this->m_clear);
     $response = array();
     $response['inserted'] = $ret !== false ? 1 : 0;
     return $response;
 }
Esempio n. 2
0
 public function execute()
 {
     $isAdmin = Api_Bo_Users::isUserAdmin($this->getUserId());
     if (!$isAdmin) {
         throw new Exception('Only the administrator can delete networks.');
     }
     $enid = $this->m_nid;
     Api_Bo_Network::deleteNetwork($enid);
     return true;
 }
 /**
  * Gets the payment gateway information, if it exists in the database.
  *
  * @return Array[user][id]
  * @throws Exception
  */
 public function execute()
 {
     //make sure calling application is a default application
     $this->checkDefaultApp();
     if (!Api_Bo_Users::isUserAdmin($this->getUserId())) {
         throw new OpenFBAPIException('Only the admin user may set a payment gateway.');
     }
     $response = array();
     $result = Api_Bo_Payments::getGateway();
     $response['gateway'] = $result;
     return $response;
 }
Esempio n. 4
0
 /**
  * Queries the friends and users table to match the query given.
  * If no query is provided it returns all friends.
  *
  * @return array
  */
 public function execute()
 {
     $q = $this->getApiParam('query');
     $ret = Api_Bo_Users::searchUsers($q);
     $response = array();
     if (empty($ret)) {
         $response['users'] = array();
     } else {
         $response['users'] = $ret;
     }
     return $response;
 }
 /**
  * Execute the api call to get user app list.
  */
 public function execute()
 {
     $isAdmin = Api_Bo_Users::isUserAdmin($this->getUserId());
     if (!$isAdmin) {
         throw new Exception('Only the administrator set network properties.');
     }
     $this->checkDefaultApp();
     $enid = $this->m_nid;
     $eprops = array();
     foreach ($this->m_props as $name => $val) {
         $ename = $name;
         $eval = $val;
         $eprops[$ename] = $eval;
     }
     Api_Bo_Network::setNetworkProperties($this->getUserId(), $enid, $eprops);
     return true;
 }
 /**
  * Creates the user if it's not in the DB.  Throws an exception if the user already exists!
  *
  * @return Array[user][id]
  * @throws Exception
  */
 public function execute()
 {
     if (!Api_Bo_Users::isUserAdmin($this->getUserId())) {
         throw new OpenFBAPIException('Only the admin user may set a payment gateway.');
     }
     $response = array();
     $result = Api_Bo_Payments::getGateway();
     if (count($result) == 0) {
         Api_Bo_Payments::createGateway($this->type, $this->subject, $this->password);
         $response['gateway'] = array();
         $response['gateway']['type'] = $this->type;
         $response['gateway']['subject'] = $this->subject;
         $response['gateway']['password'] = $this->password;
     } else {
         throw new OpenFBAPIException('Payment gateway' . $this->type . ' already exists!  Only one payment gateway may be provisioned.');
     }
     return $response;
 }
 /**
  * Execute the api call to get user app list.
  */
 public function execute()
 {
     $isAdmin = Api_Bo_Users::isUserAdmin($this->getUserId());
     if (!$isAdmin) {
         throw new Exception('Only the administrator view network properties.');
     }
     $this->checkDefaultApp();
     $enids = array();
     foreach ($this->m_nids as $nid) {
         $enids[] = $nid;
     }
     $eprops = array();
     foreach ($this->m_props as $name => $val) {
         $ename = $name;
         $eval = $val;
         $eprops[$ename] = $eval;
     }
     $props = Api_Bo_Network::getNetworkProperties($this->getUserId(), $enids, $eprops);
     $response = array('networks' => $props);
     return $response;
 }
 /**
  * @param $pastTimestamp all friends added after this time are counted
  *                       you can use Api_Bo_Util::getPastTimestamp() to build this
  * @return float number of apps the average user has registered since the given timestamp 
  * @see Api_Bo_Util::getPastTimestamp()
  */
 private function getAverageCountOfRecentlyRegisteredAppsPerUser($pastTimestamp)
 {
     $_totalAppReg = Api_Bo_Users::getTotalCountOfUserAppRegistrations($pastTimestamp);
     return (double) $_totalAppReg / $this->totalUsers;
 }