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; }
/** * 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; }