Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
ad3n committed Jan 30, 2022
1 parent daf77a2 commit 5244d94
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 17 deletions.
8 changes: 6 additions & 2 deletions lib/Admin/Controller/ApiClient/Audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
#[Permission(menu: 'AUDIT', actions: [Permission::VIEW])]
final class Audit extends AbstractController
{
public function __construct(private readonly ApiClientService $service, private readonly UserService $userService, private readonly AuditService $audit, private readonly Reader $reader)
{
public function __construct(
private readonly ApiClientService $service,
private readonly UserService $userService,
private readonly AuditService $audit,
private readonly Reader $reader,
) {
}

#[Route(path: '/users/{userId}/api-clients/{id}/audit', name: Audit::class, methods: ['GET'], priority: -255)]
Expand Down
7 changes: 5 additions & 2 deletions lib/Admin/Controller/ApiClient/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#[Permission(menu: 'APICLIENT', actions: [Permission::VIEW])]
final class Download extends AbstractController
{
public function __construct(private readonly ApiClientService $service, private readonly UserService $userService, private readonly SerializerInterface $serializer)
{
public function __construct(
private readonly ApiClientService $service,
private readonly UserService $userService,
private readonly SerializerInterface $serializer,
) {
}

#[Route(path: '/users/{userId}/api-clients/download', name: Download::class, methods: ['GET'])]
Expand Down
7 changes: 5 additions & 2 deletions lib/Admin/Controller/ApiClient/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
#[Permission(menu: 'APICLIENT', actions: [Permission::VIEW])]
final class Report extends AbstractController
{
public function __construct(private readonly ApiClientRequestService $service, private readonly UserService $userService, private readonly Paginator $paginator)
{
public function __construct(
private readonly ApiClientRequestService $service,
private readonly UserService $userService,
private readonly Paginator $paginator,
) {
}

#[Route(path: '/users/{userId}/api-clients/{id}/logs', name: Report::class, methods: ['GET'])]
Expand Down
7 changes: 5 additions & 2 deletions lib/Admin/Controller/Me/CreateApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
*/
final class CreateApiClient extends AbstractController
{
public function __construct(private readonly UserProviderFactory $userProviderFactory, private readonly SettingService $setting, private readonly ApiClientService $service)
{
public function __construct(
private readonly UserProviderFactory $userProviderFactory,
private readonly SettingService $setting,
private readonly ApiClientService $service,
) {
}

#[Route(path: '/me/api-clients', name: CreateApiClient::class, methods: ['POST'])]
Expand Down
6 changes: 4 additions & 2 deletions lib/Admin/Controller/Me/DeleteApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use KejawenLab\ApiSkeleton\Admin\AdminContext;
use KejawenLab\ApiSkeleton\ApiClient\ApiClientService;
use KejawenLab\ApiSkeleton\ApiClient\Model\ApiClientInterface;
use KejawenLab\ApiSkeleton\Security\Model\UserInterface;
use KejawenLab\ApiSkeleton\Security\Service\UserProviderFactory;
use KejawenLab\ApiSkeleton\Security\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand All @@ -33,8 +34,9 @@ public function __invoke(Request $request, string $id): Response
}

$user = $this->userProviderFactory->getRealUser($user);
$name = $request->request->get('name');
if ('' === $name) {
/** @var UserInterface $user */
$name = $request->request->get('name', null);
if (empty($name)) {
$this->addFlash('error', 'sas.page.api_client.name_not_provided');

return new RedirectResponse($this->generateUrl(Profile::class));
Expand Down
2 changes: 1 addition & 1 deletion lib/ApiClient/Query/FilterByLoggedUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class FilterByLoggedUserExtension extends AbstractQueryExtension
{
public function __construct(AliasHelper $aliasHelper, private readonly TokenStorageInterface $tokenStorage)
{
$this->aliasHelper = $aliasHelper;
parent::__construct($aliasHelper);
}

public function apply(QueryBuilder $queryBuilder, Request $request): void
Expand Down
3 changes: 0 additions & 3 deletions lib/Audit/AuditItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ final class AuditItem
{
public function __construct(
private readonly string $type,
/*
* @var array<string, mixed>
*/
private readonly array $data,
private readonly ?string $logTime,
private readonly ?string $userId,
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/Me/DeleteApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class DeleteApiClient extends AbstractFOSRestController
public function __construct(
private readonly UserProviderFactory $userProviderFactory,
private readonly ApiClientService $service,
private readonly TranslatorInterface $translator
private readonly TranslatorInterface $translator,
) {
}

Expand Down
7 changes: 6 additions & 1 deletion lib/Media/Query/SearchQueryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ final class SearchQueryExtension extends AbstractQueryExtension
{
public function apply(QueryBuilder $queryBuilder, Request $request): void
{
$queryBuilder->andWhere($queryBuilder->expr()->eq(sprintf('%s.hidden', $this->aliasHelper->findAlias('root')), $queryBuilder->expr()->literal(false)));
$queryBuilder->andWhere(
$queryBuilder->expr()->eq(
sprintf('%s.hidden', $this->aliasHelper->findAlias('root')),
$queryBuilder->expr()->literal(false)
)
);
$queryBuilder->andWhere(
$queryBuilder->expr()->like(
sprintf('UPPER(%s.fileName)', $this->aliasHelper->findAlias('root')),
Expand Down
2 changes: 1 addition & 1 deletion lib/Security/Twig/PermissionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function canViewAudit(): bool
return true;
}

return $this->authorization->authorize(new Permission(['menu' => 'audit', 'actions' => 'view']));
return $this->authorization->authorize(new Permission('audit', ['view']));
}

public function isSuperAdmin(): bool
Expand Down

0 comments on commit 5244d94

Please sign in to comment.