Skip to content

Commit

Permalink
fix transfert
Browse files Browse the repository at this point in the history
  • Loading branch information
fiste788 committed Apr 19, 2024
1 parent 310f100 commit a74306b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/Controller/Admin/TransfertsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@
namespace App\Controller\Admin;

use App\Controller\AppController;
use App\Service\TransfertService;
use Burzum\CakeServiceLayer\Service\ServiceAwareTrait;
use Cake\Event\EventInterface;
use Psr\Http\Message\ResponseInterface;

/**
* @property \App\Model\Table\TransfertsTable $Transferts
* @property \App\Service\TransfertService $Transfert
*/
class TransfertsController extends AppController
{
/**
* @inheritDoc
*/
public function __construct(private TransfertService $Transfert)
{
}
use ServiceAwareTrait;

/**
* {@inheritDoc}
Expand All @@ -30,6 +26,7 @@ public function beforeFilter(EventInterface $event): void
{
parent::beforeFilter($event);
$this->Crud->mapAction('add', 'Crud.Add');
$this->loadService('Transfert');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Policy/RequestPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class RequestPolicy
*/
public function canAccess(?User $identity, ServerRequest $request): bool
{
if ($request->getParam('prefix') === 'Admin' && $identity != null && !$identity->admin) {
if (strtolower((string) $request->getParam('prefix')) === 'admin' && $identity != null && !$identity->admin) {
return false;
}

if ($request->getParam('prefix') === 'Championships') {
if (strtolower((string) $request->getParam('prefix')) === 'championships') {
$championshipId = (int)$request->getParam('championship_id');

return $identity != null && $identity->isInChampionship($championshipId);
Expand Down

0 comments on commit a74306b

Please sign in to comment.