diff --git a/bootstrap/gwcheck.php b/bootstrap/gwcheck.php index 28ced5366a..31f98f8edd 100644 --- a/bootstrap/gwcheck.php +++ b/bootstrap/gwcheck.php @@ -8,7 +8,7 @@ # * Mode enabling flag # Check for flags that enable the operation of this mode -# file: gwcheck.enabled , in the same folder along this file +# file: install_debug_mode.enabled , in the same folder along this file # environment: USH_PLATFORM_INSTALL_DEBUG_MODE_ENABLED variable # (NOTE that the .env file in the base folder is NOT parsed for this script!) $enabled = diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 5c5db188c3..f96c53f1de 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -4,6 +4,7 @@ * [Code of Conduct](code-of-conduct/README.md) * [Values](code-of-conduct/values.md) * [Contributing \| Getting Involved](contributing-or-getting-involved/README.md) + * [Specific tasks needed for COVID19-support](contributing-or-getting-involved/covid.md) * [Add code to Ushahidi](contributing-or-getting-involved/workflow-for-adding-code.md) * [Encouraging contribution from non-developers](contributing-or-getting-involved/encouraging-contribution-from-non-developers.md) * [Frequently Asked Questions](frequently-asked-questions.md) diff --git a/docs/contributing-or-getting-involved/README.md b/docs/contributing-or-getting-involved/README.md index 71b95bcb68..047e90faea 100644 --- a/docs/contributing-or-getting-involved/README.md +++ b/docs/contributing-or-getting-involved/README.md @@ -17,6 +17,10 @@ We love having you here. But before you start, to ensure everyone has a good exp There are many ways to get involved with Ushahidi, and some of them are great for first time contributors. If you never contributed to Open Source Software before, or need more guidance doing it, please join the community in one of the channels listed [here](../get-in-touch.md). +### 🦠 I want to contribute to your work on COVID-19 response + +Ushahidi is open source software created for the benefit of a large global community improving the world for themselves and others, holding governments accountable, and raising their voices to be more powerful together. As we see the COVID-19 pandemic wreak havoc globally, we have also seen a large interest and use of our tools. Today, we are reaching out to technologists everywhere to ask for your help to make Ushahidi Platform better. Head over to our [COVID-19 specific page](covid.md) to learn more on how you can support us helping our users. + ### 📝 **I am interested in writing documentation** **I**f you find an area of the Ushahidi platform that could use better docs, we would love to hear from you in an [issue](https://github.com/ushahidi/platform/issues/new/choose), and would be seriously excited if you send a [Pull Request](https://github.com/ushahidi/platform/compare). **This is a great way to get involved,** and one of the highest impact changes you can make at the moment. You can choose to work on user documentation, fix typos, or add new sections for discussion and collaboration with the community. Every little bit helps. diff --git a/docs/contributing-or-getting-involved/covid.md b/docs/contributing-or-getting-involved/covid.md new file mode 100644 index 0000000000..74e10251d6 --- /dev/null +++ b/docs/contributing-or-getting-involved/covid.md @@ -0,0 +1,22 @@ +# Specific tasks needed for COVID19-support + +Ushahidi is open source software created for the benefit of a large global community improving the world for themselves and others, holding governments accountable, and raising their voices to be more powerful together. Today, we are reaching out to technologists everywhere to ask for your help to make Ushahidi Platform better. + +If you have skills that you want to put to work in favor of those who depend on our tools, and some free time \(which we fully acknowledge is a privilege not everyone has\) this is an unprecedented opportunity to do so. + +#### Some specific areas where we need help + +This are in a rough order of priority, they may change at any time. Check in with our team if you have questions. + +* **Write a blog post** about your experience using Ushahidi Platform V3+ and what you learned from it, then share it with us so we can amplify and help others who are setting up their first Ushahidi Platform deployment. +* **Improve our location and map functionality** so that we can [**support polygons as well as points**](https://github.com/ushahidi/platform/issues/1231)**.** You can also work on [**capturing zoom levels and other metadata**](https://github.com/ushahidi/platform/issues/600) for location fields, as described here. Follow up with any questions you may have to collaborate on specs and implementation. +* **Improve the import feature** so that it's faster and easier for new deployers to get started using data they already have. The import feature can be a little unstable at times, and we're looking for help making it better. +* **Get involved in fixing other bugs and improving features:** there are hundreds of bug and feature improvement reports, and while a vast majority of them take a little work and experience to get right, some are actually quite accessible even for beginners. [Follow this link](https://github.com/ushahidi/platform/issues?q=is%3Aopen+is%3Aissue+label%3ABug) if you are looking for an opportunity to squash some bugs for the greater good. Our team will be forever thankful. +* **Implement an USSD integration** that will make it possible to collect data in a more structured fashion than what we currently have in our SMS integration. Tim made amazing progress in his Africa's Talking USSD integration prototype, supported by David Losada, and we would be thankful to anyone who is willing to add support for USSD providers. [https://github.com/ushahidi/platform-api-ussd-service](https://github.com/ushahidi/platform-api-ussd-service) + * You are also welcome to collaborate and extend the work done by Tim and David with Africa's Talking, as it can always be improved. In particular, it needs some work in terms of field validation, a feature they already worked on and that we deem essential for easy collection of data that truly helps populations at risk with limited resources. **** + * **Work on a way to setup the USSD integration that allows people without technology background to do it:** collaborate with the Ushahidi team on designing an easy to use setup tool so that others can use USSD in their deployments. + + + +To get started, begin with setting up the Platform-api and Platform-client. Head over [here](../development-and-code/setup_alternatives/) to see our setup-guides. + diff --git a/docs/docs/.gitbook/assets/63230917-e5879a00-c1c8-11e9-8f6e-e62c83dd1d85.png b/docs/docs/.gitbook/assets/63230917-e5879a00-c1c8-11e9-8f6e-e62c83dd1d85.png new file mode 100644 index 0000000000..fb4d093cef Binary files /dev/null and b/docs/docs/.gitbook/assets/63230917-e5879a00-c1c8-11e9-8f6e-e62c83dd1d85.png differ diff --git a/docs/docs/.gitbook/assets/api-request-flow-1.png b/docs/docs/.gitbook/assets/api-request-flow-1.png new file mode 100644 index 0000000000..f270621f4d Binary files /dev/null and b/docs/docs/.gitbook/assets/api-request-flow-1.png differ diff --git a/docs/docs/.gitbook/assets/app-tiers-1.png b/docs/docs/.gitbook/assets/app-tiers-1.png new file mode 100644 index 0000000000..db13484b87 Binary files /dev/null and b/docs/docs/.gitbook/assets/app-tiers-1.png differ diff --git a/docs/docs/.gitbook/assets/arch-layers-1 (1).png b/docs/docs/.gitbook/assets/arch-layers-1 (1).png new file mode 100644 index 0000000000..c058326c4f Binary files /dev/null and b/docs/docs/.gitbook/assets/arch-layers-1 (1).png differ diff --git a/docs/docs/.gitbook/assets/arch-layers-1.png b/docs/docs/.gitbook/assets/arch-layers-1.png new file mode 100644 index 0000000000..c058326c4f Binary files /dev/null and b/docs/docs/.gitbook/assets/arch-layers-1.png differ diff --git a/docs/docs/.gitbook/assets/create-usecase-1.png b/docs/docs/.gitbook/assets/create-usecase-1.png new file mode 100644 index 0000000000..aaef8ad044 Binary files /dev/null and b/docs/docs/.gitbook/assets/create-usecase-1.png differ diff --git a/docs/docs/.gitbook/assets/create-usecase-collab (3).png b/docs/docs/.gitbook/assets/create-usecase-collab (3).png new file mode 100644 index 0000000000..8de17327e4 Binary files /dev/null and b/docs/docs/.gitbook/assets/create-usecase-collab (3).png differ diff --git a/docs/docs/.gitbook/assets/create-usecase-collab.png b/docs/docs/.gitbook/assets/create-usecase-collab.png new file mode 100644 index 0000000000..8de17327e4 Binary files /dev/null and b/docs/docs/.gitbook/assets/create-usecase-collab.png differ diff --git a/docs/docs/.gitbook/assets/data-flow-1.png b/docs/docs/.gitbook/assets/data-flow-1.png new file mode 100644 index 0000000000..8980320dd4 Binary files /dev/null and b/docs/docs/.gitbook/assets/data-flow-1.png differ diff --git a/docs/docs/.gitbook/assets/delete-usecase-1.png b/docs/docs/.gitbook/assets/delete-usecase-1.png new file mode 100644 index 0000000000..d5d7e57a64 Binary files /dev/null and b/docs/docs/.gitbook/assets/delete-usecase-1.png differ diff --git a/docs/docs/.gitbook/assets/gitbook-graphic.png b/docs/docs/.gitbook/assets/gitbook-graphic.png new file mode 100644 index 0000000000..f35c203d66 Binary files /dev/null and b/docs/docs/.gitbook/assets/gitbook-graphic.png differ diff --git a/docs/docs/.gitbook/assets/github-1.png b/docs/docs/.gitbook/assets/github-1.png new file mode 100644 index 0000000000..a9d0e1ff60 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-1.png differ diff --git a/docs/docs/.gitbook/assets/github-10.png b/docs/docs/.gitbook/assets/github-10.png new file mode 100644 index 0000000000..ffdd7f396e Binary files /dev/null and b/docs/docs/.gitbook/assets/github-10.png differ diff --git a/docs/docs/.gitbook/assets/github-2.png b/docs/docs/.gitbook/assets/github-2.png new file mode 100644 index 0000000000..54c9f3a285 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-2.png differ diff --git a/docs/docs/.gitbook/assets/github-3.png b/docs/docs/.gitbook/assets/github-3.png new file mode 100644 index 0000000000..394e582b73 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-3.png differ diff --git a/docs/docs/.gitbook/assets/github-4.png b/docs/docs/.gitbook/assets/github-4.png new file mode 100644 index 0000000000..b0def5ed81 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-4.png differ diff --git a/docs/docs/.gitbook/assets/github-5.png b/docs/docs/.gitbook/assets/github-5.png new file mode 100644 index 0000000000..d056370bc3 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-5.png differ diff --git a/docs/docs/.gitbook/assets/github-6.png b/docs/docs/.gitbook/assets/github-6.png new file mode 100644 index 0000000000..9f6d17744a Binary files /dev/null and b/docs/docs/.gitbook/assets/github-6.png differ diff --git a/docs/docs/.gitbook/assets/github-7.png b/docs/docs/.gitbook/assets/github-7.png new file mode 100644 index 0000000000..c36a3b54dd Binary files /dev/null and b/docs/docs/.gitbook/assets/github-7.png differ diff --git a/docs/docs/.gitbook/assets/github-8.png b/docs/docs/.gitbook/assets/github-8.png new file mode 100644 index 0000000000..c76849dce0 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-8.png differ diff --git a/docs/docs/.gitbook/assets/github-9.png b/docs/docs/.gitbook/assets/github-9.png new file mode 100644 index 0000000000..03c2e28dd8 Binary files /dev/null and b/docs/docs/.gitbook/assets/github-9.png differ diff --git a/docs/docs/.gitbook/assets/ionic.png b/docs/docs/.gitbook/assets/ionic.png new file mode 100644 index 0000000000..7d0b751b0c Binary files /dev/null and b/docs/docs/.gitbook/assets/ionic.png differ diff --git a/docs/docs/.gitbook/assets/notebook.png b/docs/docs/.gitbook/assets/notebook.png new file mode 100644 index 0000000000..b92870e9cc Binary files /dev/null and b/docs/docs/.gitbook/assets/notebook.png differ diff --git a/docs/docs/.gitbook/assets/oss-ushahidi-project.png b/docs/docs/.gitbook/assets/oss-ushahidi-project.png new file mode 100644 index 0000000000..b1361822a3 Binary files /dev/null and b/docs/docs/.gitbook/assets/oss-ushahidi-project.png differ diff --git a/docs/docs/.gitbook/assets/oss-welcome-banner.png b/docs/docs/.gitbook/assets/oss-welcome-banner.png new file mode 100644 index 0000000000..e6aef538ac Binary files /dev/null and b/docs/docs/.gitbook/assets/oss-welcome-banner.png differ diff --git a/docs/docs/.gitbook/assets/pattern-library-snackbar.png b/docs/docs/.gitbook/assets/pattern-library-snackbar.png new file mode 100644 index 0000000000..82c11dbceb Binary files /dev/null and b/docs/docs/.gitbook/assets/pattern-library-snackbar.png differ diff --git a/docs/docs/.gitbook/assets/platform-database-schema.pdf b/docs/docs/.gitbook/assets/platform-database-schema.pdf new file mode 100644 index 0000000000..94eda829dd Binary files /dev/null and b/docs/docs/.gitbook/assets/platform-database-schema.pdf differ diff --git a/docs/docs/.gitbook/assets/read-usecase-2.png b/docs/docs/.gitbook/assets/read-usecase-2.png new file mode 100644 index 0000000000..6c17a7d63c Binary files /dev/null and b/docs/docs/.gitbook/assets/read-usecase-2.png differ diff --git a/docs/docs/.gitbook/assets/screen-shot-2019-08-03-at-11.08.49.png b/docs/docs/.gitbook/assets/screen-shot-2019-08-03-at-11.08.49.png new file mode 100644 index 0000000000..8f4bc6973a Binary files /dev/null and b/docs/docs/.gitbook/assets/screen-shot-2019-08-03-at-11.08.49.png differ diff --git a/docs/docs/.gitbook/assets/screenshot-2019-09-13-at-14.16.23 (1).png b/docs/docs/.gitbook/assets/screenshot-2019-09-13-at-14.16.23 (1).png new file mode 100644 index 0000000000..720b495a87 Binary files /dev/null and b/docs/docs/.gitbook/assets/screenshot-2019-09-13-at-14.16.23 (1).png differ diff --git a/docs/docs/.gitbook/assets/screenshot-2019-09-17-at-08.05.51 (1).png b/docs/docs/.gitbook/assets/screenshot-2019-09-17-at-08.05.51 (1).png new file mode 100644 index 0000000000..92c716b57c Binary files /dev/null and b/docs/docs/.gitbook/assets/screenshot-2019-09-17-at-08.05.51 (1).png differ diff --git a/docs/docs/.gitbook/assets/search-usecase (3).png b/docs/docs/.gitbook/assets/search-usecase (3).png new file mode 100644 index 0000000000..f10dbdf7b8 Binary files /dev/null and b/docs/docs/.gitbook/assets/search-usecase (3).png differ diff --git a/docs/docs/.gitbook/assets/update-usecase-2.png b/docs/docs/.gitbook/assets/update-usecase-2.png new file mode 100644 index 0000000000..e56bbd5340 Binary files /dev/null and b/docs/docs/.gitbook/assets/update-usecase-2.png differ diff --git a/tests/integration/bootstrap/RestContext.php b/tests/integration/bootstrap/RestContext.php index e63af8300a..7ce480fce6 100644 --- a/tests/integration/bootstrap/RestContext.php +++ b/tests/integration/bootstrap/RestContext.php @@ -26,6 +26,9 @@ class RestContext implements Context private $restObjectType = null; private $restObjectMethod = 'get'; private $client = null; + /** + * @var \GuzzleHttp\Psr7\Response + */ private $response = null; private $requestUrl = null; private $apiUrl = 'api/v3'; @@ -37,6 +40,8 @@ class RestContext implements Context private $postFields = []; private $postFiles = []; + const DEBUG_MODE_SWITCH_FILE_PATH = __DIR__ . "/../../../bootstrap/install_debug_mode.enabled"; + /** * Initializes context. * Every scenario gets it's own context object. @@ -201,6 +206,24 @@ public function thatThePostFileIs($fieldName, $fieldValue) $this->postFiles[$fieldName] = $fieldValue; } + /** + * @Given /^that I have enabled debug mode$/ + */ + public function thatIHaveEnabledDebugMode() + { + fopen(self::DEBUG_MODE_SWITCH_FILE_PATH, "w"); + } + + /** + * @AfterScenario + * @Given /^that I have disabled debug mode$/ + */ + public function disableDebugModeAfterScenario() + { + if (file_exists(self::DEBUG_MODE_SWITCH_FILE_PATH)) { + unlink(self::DEBUG_MODE_SWITCH_FILE_PATH); + } + } /** * @When /^I request "([^"]*)"$/ */ @@ -211,9 +234,9 @@ public function iRequest($pageUrl) switch (strtoupper($this->restObjectMethod)) { case 'GET': $request = (array)$this->restObject; - $id = ( isset($request['id']) ) ? $request['id'] : ''; + $idAttachment = ( isset($request['id']) ) ? "/" . $request['id'] : ''; $response = $this->client - ->get($this->requestUrl.'/'.$id, [ + ->get($this->requestUrl.$idAttachment, [ 'query' => isset($request['query string']) ? trim($request['query string']) : null, 'headers' => $this->headers ]); @@ -403,6 +426,13 @@ public function theResponseIsJsonp() } } + /** + * @Then /^the response is empty/ + */ + public function theResponseIsEmpty() + { + \PHPUnit_Framework_Assert::assertEquals(0, $this->response->getBody()->getSize()); + } /** * @Given /^the response has a "([^"]*)" property$/ * @Given /^the response has an "([^"]*)" property$/ @@ -631,7 +661,7 @@ public function thePropertyIsEmpty($propertyName) $actualPropertyValue = array_get($data, $propertyName); if (!empty($actualPropertyValue)) { - throw new \Exception("Property '{$propertyName}' is not empty!\n"); + throw new \Exception("Property '{$propertyName}' is not empty but '{$actualPropertyValue}'\n"); } } diff --git a/tests/integration/gwchecker.feature b/tests/integration/gwchecker.feature new file mode 100644 index 0000000000..63ee22c0a6 --- /dev/null +++ b/tests/integration/gwchecker.feature @@ -0,0 +1,68 @@ +Feature: Gateway checker + + Scenario: normal API request should still work with enabled GW checker + Given that I have enabled debug mode + And that I want to get all "Configs" + When I request "/config" + Then the response is JSON + And the response has a "count" property + And the type of the "count" property is "numeric" + And the guzzle status code should be 200 + + Scenario Outline: get debug information with enabled GW checker + Given that I have enabled debug mode + And that I want to get all "Configs" + When I request "/?gwcheck=" + Then the response is JSON + And the response does not have a "count" property + And the "api.name" property equals "ushahidi:platform:gwcheck" + And the "api.version" property equals "0.1" + And the "data._GET.gwcheck" property equals "" + And the "data._REQUEST.gwcheck" property equals "" + And the "data._POST" property is empty + And the "data._SERVER.REQUEST_METHOD" property equals "GET" + And the "data._SERVER.QUERY_STRING" property equals "gwcheck=" + And the "data._SERVER.HTTP_ACCEPT" property equals "application/json" + And the "data._SERVER.SCRIPT_NAME" property contains "/index.php" + And the "data._SERVER.REQUEST_URI" property equals "/api/v3/?gwcheck=" + #the following line might fail when running tests on Apache + And the "data._SERVER.PATH_INFO" property equals "/api/v3/" + And the "data._SERVER.HTTP_USER_AGENT" property contains "GuzzleHttp" + And the "data._SERVER.DOCUMENT_ROOT" property contains "/platform" + And the "data._SERVER.SCRIPT_FILENAME" property contains "/platform/httpdocs/index.php" + And the "data._SERVER.HTTP_ACCEPT_CHARSET" property is empty + And the "data._SERVER.HTTP_ACCEPT_ENCODING" property is empty + And the "data._SERVER.HTTP_ACCEPT_LANGUAGE" property is empty + And the "data._SERVER.HTTP_AUTHORIZATION" property is empty + And the "data._SERVER.HTTP_CONNECTION" property is empty + And the "data._SERVER.HTTP_ORIGIN" property is empty + And the "data._SERVER.HTTP_REFERER" property is empty + And the "data._SERVER.ORIG_PATH_INFO" property is empty + And the guzzle status code should be 200 + Examples: + | endpoint | gwCheckValue | + | config | true | + | config | TRUE | + | config | 1 | + | config | anyString | + | config | false | + | does-not-exist | true | + | does-not-exist | TRUE | + | does-not-exist | 1 | + | does-not-exist | anyString | + | does-not-exist | false | + + Scenario Outline: debug information should not be visible with disabled GW checker + Given that I have disabled debug mode + And that I want to get all "Configs" + When I request "/config?gwcheck=" + Then the response is empty + And the guzzle status code should be 204 + And the "X-Ushahidi-Platform-Install-Debug-Mode" header should be "off" + Examples: + | gwCheckValue | + | true | + | TRUE | + | 1 | + | anyString | + | false |