Skip to content

Commit

Permalink
Merge tag 'rc-v4.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
rowasc committed Apr 2, 2020
2 parents 873a2b9 + f00e40b commit 460a186
Show file tree
Hide file tree
Showing 39 changed files with 129 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bootstrap/gwcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions docs/contributing-or-getting-involved/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions docs/contributing-or-getting-involved/covid.md
Original file line number Diff line number Diff line change
@@ -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.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/api-request-flow-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/app-tiers-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/arch-layers-1 (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/arch-layers-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/create-usecase-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/data-flow-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/delete-usecase-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/gitbook-graphic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/github-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/ionic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/notebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/.gitbook/assets/oss-welcome-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added docs/docs/.gitbook/assets/read-usecase-2.png
Binary file added docs/docs/.gitbook/assets/search-usecase (3).png
Binary file added docs/docs/.gitbook/assets/update-usecase-2.png
36 changes: 33 additions & 3 deletions tests/integration/bootstrap/RestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down Expand Up @@ -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 "([^"]*)"$/
*/
Expand All @@ -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
]);
Expand Down Expand Up @@ -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$/
Expand Down Expand Up @@ -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");
}
}

Expand Down
68 changes: 68 additions & 0 deletions tests/integration/gwchecker.feature
Original file line number Diff line number Diff line change
@@ -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 "/<endpoint>?gwcheck=<gwCheckValue>"
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 "<gwCheckValue>"
And the "data._REQUEST.gwcheck" property equals "<gwCheckValue>"
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=<gwCheckValue>"
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/<endpoint>?gwcheck=<gwCheckValue>"
#the following line might fail when running tests on Apache
And the "data._SERVER.PATH_INFO" property equals "/api/v3/<endpoint>"
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=<gwCheckValue>"
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 |

0 comments on commit 460a186

Please sign in to comment.