Non-API routes will accept string argument values instead of integer

This commit is contained in:
Alex Tselegidis 2022-06-19 14:40:32 +01:00
parent c0e7a082f3
commit 6b821792fa

View file

@ -40,9 +40,9 @@ class Google extends EA_Controller {
* needs to be relatively small, because a lot of API calls might be necessary and this will lead to consuming the * needs to be relatively small, because a lot of API calls might be necessary and this will lead to consuming the
* Google limit for the Calendar API usage. * Google limit for the Calendar API usage.
* *
* @param int $provider_id Provider record to be synced. * @param string $provider_id Provider record to be synced.
*/ */
public static function sync($provider_id = NULL) public static function sync(string $provider_id = NULL)
{ {
try try
{ {
@ -248,15 +248,15 @@ class Google extends EA_Controller {
* Since it is required to follow the web application flow, in order to retrieve a refresh token from the Google API * Since it is required to follow the web application flow, in order to retrieve a refresh token from the Google API
* service, this method is going to authorize the given provider. * service, this method is going to authorize the given provider.
* *
* @param int $provider_id The provider id, for whom the sync authorization is made. * @param string $provider_id The provider id, for whom the sync authorization is made.
*/ */
public function oauth(int $provider_id) public function oauth(string $provider_id)
{ {
if ( ! $this->session->userdata('user_id')) if ( ! $this->session->userdata('user_id'))
{ {
show_error('Forbidden', 403); show_error('Forbidden', 403);
} }
// Store the provider id for use on the callback function. // Store the provider id for use on the callback function.
session(['oauth_provider_id' => $provider_id]); session(['oauth_provider_id' => $provider_id]);
@ -281,7 +281,7 @@ class Google extends EA_Controller {
{ {
abort(403, 'Forbidden'); abort(403, 'Forbidden');
} }
$code = request('code'); $code = request('code');
if (empty($code)) if (empty($code))
@ -325,7 +325,7 @@ class Google extends EA_Controller {
{ {
try try
{ {
$provider_id = request('provider_id'); $provider_id = (int)request('provider_id');
if (empty($provider_id)) if (empty($provider_id))
{ {