Skip to content

Commit

Permalink
refactor(wip): V5 auth policies
Browse files Browse the repository at this point in the history
  • Loading branch information
webong committed Nov 16, 2023
1 parent bebc3a3 commit 91dc7b7
Show file tree
Hide file tree
Showing 90 changed files with 529 additions and 1,466 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/UserCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Ushahidi\Core\Facade\Feature;
use Ushahidi\Core\Support\Facades\Feature;
use Illuminate\Support\Facades\Validator;
use Ushahidi\Core\Exception\ValidatorException;
use Ushahidi\Core\Data\TosRepository;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/CheckFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Http\Middleware;

use Closure;
use Ushahidi\Core\Facade\Feature;
use Ushahidi\Core\Support\Facades\Feature;

class CheckFeature
{
Expand Down
3 changes: 1 addition & 2 deletions app/Providers/BusServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

use App\Bus\Query\QueryBus;
use Illuminate\Support\ServiceProvider;
use Ushahidi\Core\Data\Webhook as EntityWebhook;
use Ushahidi\Modules\V5\Actions\CountryCode\Queries\FetchCountryCodeByIdQuery;
use Ushahidi\Modules\V5\Actions\CountryCode\Queries\FetchCountryCodeQuery;
use Ushahidi\Modules\V5\Actions\CountryCode\Handlers\FetchCountryCodeByIdQueryHandler;
Expand Down Expand Up @@ -488,7 +487,7 @@ private function registerQueries(): void
Survey\Queries\GetSurveyIdsWithPrivateLocationQuery::class,
Survey\Handlers\GetSurveyIdsWithPrivateLocationQueryHandler::class
);



$queryBus->register(
Expand Down
25 changes: 13 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Ushahidi/Contracts/Repository/SearchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Ushahidi\Contracts\Search;

interface SearchRepository extends EntityGet
interface SearchRepository extends EntityGet, EntityExists
{
/**
* Get fields that can be used for searches.
Expand Down
2 changes: 1 addition & 1 deletion src/Ushahidi/Contracts/Repository/UpdateRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Ushahidi\Contracts\Entity;

interface UpdateRepository
interface UpdateRepository extends EntityGet, EntityExists
{
/**
* @param array|\Ushahidi\Contracts\Entity $entity
Expand Down
9 changes: 5 additions & 4 deletions src/Ushahidi/Core/Data/ConfigRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@

namespace Ushahidi\Core\Data;

use Ushahidi\Contracts\Repository\ReadRepository;
use Ushahidi\Contracts\Repository\UpdateRepository;
use Ushahidi\Contracts\Repository\DeleteRepository;

/**
* @method array groups()
* @method array all(array $groups = null)
*
* @implements \Ushahidi\Contracts\Repository\ReadRepository
* @implements \Ushahidi\Contracts\Repository\UpdateRepository
* @implements \Ushahidi\Contracts\Repository\DeleteRepository
*/
interface ConfigRepository
interface ConfigRepository extends ReadRepository, UpdateRepository, DeleteRepository
{

}
6 changes: 6 additions & 0 deletions src/Ushahidi/Core/Data/ExportJobEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ interface ExportJobEntity extends Entity
const STATUS_EXPORTED_TO_CDN = 'EXPORTED_TO_CDN';

const STATUS_PENDING_HDX = 'PENDING_HDX';

const DEFAULT_INCLUDE_HXL = 0;

const DEFAULT_SEND_TO_BROWSER = 0;

const DEFAULT_SEND_TO_HDX = 0;
}
2 changes: 1 addition & 1 deletion src/Ushahidi/Core/Data/RoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface RoleRepository extends
{
/**
* @param string $value
* @return \Ushahidi\Core\Data\Role
* @return \Ushahidi\Core\Data\RoleEntity
*/
public function getByName($value);
}
File renamed without changes.
19 changes: 19 additions & 0 deletions src/Ushahidi/Core/Data/WebhookEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* Ushahidi Platform Tag Entity
*
* @author Ushahidi Team <[email protected]>
* @package Ushahidi\Platform
* @copyright 2014 Ushahidi
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3)
*/

namespace Ushahidi\Core\Data;

use Ushahidi\Contracts\Entity;

interface WebhookEntity extends Entity
{

}
2 changes: 1 addition & 1 deletion src/Ushahidi/Core/Ohanzee/Entity/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Ushahidi\Core\Ohanzee\Entity;

use Ushahidi\Core\Data\NotificationEntity;
use Ushahidi\Core\Ohanzee\StaticEntity;
use Ushahidi\Core\Data\Notification as NotificationEntity;

class Notification extends StaticEntity implements NotificationEntity
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ushahidi/Core/Ohanzee/Entity/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Illuminate\Support\Facades\Auth;
use Ushahidi\Core\Ohanzee\StaticEntity;
use \Ushahidi\Core\Data\SetEntity;
use Ushahidi\Core\Data\SetEntity;

class Set extends StaticEntity implements SetEntity
{
Expand Down
25 changes: 13 additions & 12 deletions src/Ushahidi/Core/Ohanzee/Entity/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

namespace Ushahidi\Core\Ohanzee\Entity;

use Ushahidi\Core\Data\WebhookEntity;
use Ushahidi\Core\Ohanzee\StaticEntity;

class Webhook extends StaticEntity
class Webhook extends StaticEntity implements WebhookEntity
{
protected $id;
protected $form_id;
Expand Down Expand Up @@ -43,21 +44,21 @@ protected function getDerived()
protected function getDefinition()
{
return [
'id' => 'int',
'name' => 'string',
'url' => 'string',
'shared_secret' => 'string',
'webhook_uuid' => 'string',
'event_type' => 'string',
'entity_type' => 'string',
'id' => 'int',
'name' => 'string',
'url' => 'string',
'shared_secret' => 'string',
'webhook_uuid' => 'string',
'event_type' => 'string',
'entity_type' => 'string',
'source_field_key' => 'string',
'destination_field_key' => 'string',
'user' => false,
'user_id' => 'int',
'user' => false,
'user_id' => 'int',
'form' => false, /* alias */
'form_id' => 'int',
'created' => 'int',
'updated' => 'int',
'created' => 'int',
'updated' => 'int',
];
}

Expand Down
6 changes: 3 additions & 3 deletions src/Ushahidi/Core/Ohanzee/Repository/ApiKeyRepository.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Ushahidi ApiKeyEntity Repository
* Ushahidi ApiKey Repository
*
* @author Ushahidi Team <[email protected]>
* @package Ushahidi\Application
Expand All @@ -15,7 +15,7 @@
use Ushahidi\Contracts\Entity;
use Ushahidi\Core\Tool\SearchData;
use Ushahidi\Core\Concerns\AdminAccess;
use Ushahidi\Core\Ohanzee\Entity\ApiKeyEntity;
use Ushahidi\Core\Ohanzee\Entity\ApiKey;
use Ushahidi\Contracts\Repository\EntityExists;
use Ushahidi\Contracts\Repository\CreateRepository;
use Ushahidi\Core\Data\ApiKeyRepository as ApiKeyRepositoryContract;
Expand All @@ -31,7 +31,7 @@ protected function getTable()

public function getEntity(array $data = null)
{
return new ApiKeyEntity($data);
return new ApiKey($data);
}

// OhanzeeRepository
Expand Down
117 changes: 0 additions & 117 deletions src/Ushahidi/Core/Ohanzee/Repository/Config/features.php

This file was deleted.

Loading

0 comments on commit 91dc7b7

Please sign in to comment.