public function postEdit() { $post = json_decode(file_get_contents("php://input")); $business_id = Business::getBusinessIdByTerminalId($post->terminal_id); if (Helper::isBusinessOwner($business_id, Helper::userId())) { // PAG added permission checking if ($this->validateTerminalName($business_id, $post->name, $post->terminal_id)) { Terminal::setName($post->terminal_id, $post->name); return json_encode(array('status' => 1)); } else { return json_encode(array('status' => 0)); } } else { return json_encode(array('message' => 'You are not allowed to access this function.')); } }