Release 2.0.27 (#4107)

This commit is contained in:
Kevin Papst
2023-07-04 17:01:29 +02:00
committed by GitHub
parent 6a99ad41ca
commit 651f812da8
62 changed files with 506 additions and 427 deletions

View File

@@ -122,17 +122,12 @@ abstract class AbstractController extends BaseAbstractController implements Serv
* Adds an "error" flash message to the stack.
*
* @param string $translationKey
* @param array<string, string>|string $reason passing an array is deprecated
* @param string $reason
* @return void
* @throws \Exception
*/
protected function flashError(string $translationKey, array|string $reason = ''): void
protected function flashError(string $translationKey, string $reason = ''): void
{
if (\is_array($reason)) {
@trigger_error('Calling "flashError" with an array $reason is deprecated and will be removed soon. Refactor and pass a string instead.', E_USER_DEPRECATED);
$reason = \array_key_exists('%reason%', $reason) ? $reason['%reason%'] : '';
}
$this->addFlashTranslated('error', $translationKey, ['%reason%' => $reason]);
}

View File

@@ -47,7 +47,6 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
* Controller used to manage activities.
*/
#[Route(path: '/admin/activity')]
#[IsGranted(new Expression("is_granted('view_activity') or is_granted('view_teamlead_activity') or is_granted('view_team_activity')"))]
final class ActivityController extends AbstractController
{
public function __construct(private ActivityRepository $repository, private SystemConfiguration $configuration, private EventDispatcherInterface $dispatcher, private ActivityService $activityService)
@@ -56,6 +55,7 @@ final class ActivityController extends AbstractController
#[Route(path: '/', defaults: ['page' => 1], name: 'admin_activity', methods: ['GET'])]
#[Route(path: '/page/{page}', requirements: ['page' => '[1-9]\d*'], name: 'admin_activity_paginated', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('listing', 'activity')"))]
public function indexAction(int $page, Request $request): Response
{
$query = new ActivityQuery();
@@ -329,7 +329,11 @@ final class ActivityController extends AbstractController
$this->activityService->updateActivity($activity);
$this->flashSuccess('action.update.success');
return $this->redirectToRoute('activity_details', ['id' => $activity->getId()]);
if ($this->isGranted('view', $activity)) {
return $this->redirectToRoute('activity_details', ['id' => $activity->getId()]);
} else {
return new Response();
}
} catch (Exception $ex) {
$this->flashUpdateException($ex);
}
@@ -389,6 +393,7 @@ final class ActivityController extends AbstractController
}
#[Route(path: '/export', name: 'activity_export', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('listing', 'activity')"))]
public function exportAction(Request $request, EntityWithMetaFieldsExporter $exporter): Response
{
$query = new ActivityQuery();

View File

@@ -47,10 +47,9 @@ use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* Controller used to manage customer in the admin part of the site.
* Controller used to manage customers.
*/
#[Route(path: '/admin/customer')]
#[IsGranted(new Expression("is_granted('view_customer') or is_granted('view_teamlead_customer') or is_granted('view_team_customer')"))]
final class CustomerController extends AbstractController
{
public function __construct(private CustomerRepository $repository, private EventDispatcherInterface $dispatcher)
@@ -59,6 +58,7 @@ final class CustomerController extends AbstractController
#[Route(path: '/', defaults: ['page' => 1], name: 'admin_customer', methods: ['GET'])]
#[Route(path: '/page/{page}', requirements: ['page' => '[1-9]\d*'], name: 'admin_customer_paginated', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('listing', 'customer')"))]
public function indexAction(int $page, Request $request): Response
{
$query = new CustomerQuery();
@@ -452,6 +452,7 @@ final class CustomerController extends AbstractController
}
#[Route(path: '/export', name: 'customer_export', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('listing', 'customer')"))]
public function exportAction(Request $request, EntityWithMetaFieldsExporter $exporter): Response
{
$query = new CustomerQuery();
@@ -492,7 +493,11 @@ final class CustomerController extends AbstractController
return $this->redirectToRouteAfterCreate('customer_details', ['id' => $customer->getId()]);
}
return $this->redirectToRoute('customer_details', ['id' => $customer->getId()]);
if ($this->isGranted('view', $customer)) {
return $this->redirectToRoute('customer_details', ['id' => $customer->getId()]);
} else {
return new Response();
}
} catch (\Exception $ex) {
$this->handleFormUpdateException($ex, $editForm);
}

View File

@@ -433,7 +433,7 @@ final class InvoiceController extends AbstractController
$table->addColumn('calculator', ['class' => 'd-none', 'orderBy' => false, 'title' => 'invoice_calculator', 'translation_domain' => 'invoice-calculator']);
$table->addColumn('renderer', ['class' => 'd-none', 'orderBy' => false, 'title' => 'invoice_renderer', 'translation_domain' => 'invoice-renderer']);
$table->addColumn('language', ['class' => 'd-none text-nowrap', 'orderBy' => false]);
$table->addColumn('actions', ['class' => 'actions', 'orderBy' => false]);
$table->addColumn('actions', ['class' => 'actions']);
$page = $this->createPageSetup('admin_invoice_template.title');
$page->setDataTable($table);

View File

@@ -54,7 +54,6 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
* Controller used to manage projects.
*/
#[Route(path: '/admin/project')]
#[IsGranted(new Expression("is_granted('view_project') or is_granted('view_teamlead_project') or is_granted('view_team_project')"))]
final class ProjectController extends AbstractController
{
public function __construct(private ProjectRepository $repository, private SystemConfiguration $configuration, private EventDispatcherInterface $dispatcher, private ProjectService $projectService)
@@ -63,6 +62,7 @@ final class ProjectController extends AbstractController
#[Route(path: '/', defaults: ['page' => 1], name: 'admin_project', methods: ['GET'])]
#[Route(path: '/page/{page}', requirements: ['page' => '[1-9]\d*'], name: 'admin_project_paginated', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('listing', 'project')"))]
public function indexAction(int $page, Request $request): Response
{
$query = new ProjectQuery();
@@ -435,7 +435,11 @@ final class ProjectController extends AbstractController
$this->projectService->updateProject($project);
$this->flashSuccess('action.update.success');
return $this->redirectToRoute('project_details', ['id' => $project->getId()]);
if ($this->isGranted('view', $project)) {
return $this->redirectToRoute('project_details', ['id' => $project->getId()]);
} else {
return new Response();
}
} catch (\Exception $ex) {
$this->flashUpdateException($ex);
}
@@ -512,6 +516,7 @@ final class ProjectController extends AbstractController
}
#[Route(path: '/export', name: 'project_export', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('listing', 'project')"))]
public function exportAction(Request $request, EntityWithMetaFieldsExporter $exporter): Response
{
$query = new ProjectQuery();