Fix somes issues
This commit is contained in:
@@ -98,9 +98,12 @@ class AdminController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/user/view/{id}', name: 'user_view')]
|
||||
public function userView(PaginatorInterface $paginator, User $User): Response
|
||||
public function userView(PaginatorInterface $paginator, User $User, Request $request): Response
|
||||
{
|
||||
$pagination = $paginator->paginate($User->getDocuments());
|
||||
$pagination = $paginator->paginate(
|
||||
$User->getDocuments(),
|
||||
$request->query->getInt('page', 1)
|
||||
);
|
||||
return $this->render('admin/user_view.html.twig', [
|
||||
'controller_name' => 'AdminController',
|
||||
'user' => $User,
|
||||
|
||||
@@ -54,7 +54,8 @@ class DirectoryController extends AbstractController
|
||||
}
|
||||
|
||||
$pagination = $paginator->paginate(
|
||||
$req->getResult()
|
||||
$req->getResult(),
|
||||
$request->query->getInt('page', 1)
|
||||
);
|
||||
|
||||
return $this->render('directory/list.html.twig', [
|
||||
|
||||
@@ -50,7 +50,8 @@ class FolderController extends AbstractController
|
||||
}
|
||||
|
||||
$pagination = $paginator->paginate(
|
||||
$req->getResult()
|
||||
$req->getResult(),
|
||||
$request->query->getInt('page', 1)
|
||||
);
|
||||
|
||||
|
||||
@@ -141,7 +142,8 @@ class FolderController extends AbstractController
|
||||
}
|
||||
|
||||
$pagination = $paginator->paginate(
|
||||
$req->getResult()
|
||||
$req->getResult(),
|
||||
$request->query->getInt('page', 1)
|
||||
);
|
||||
|
||||
return $this->render('folder/document.html.twig', [
|
||||
|
||||
@@ -55,7 +55,10 @@ class MeController extends AbstractController
|
||||
return $this->render('me/index.html.twig', [
|
||||
'controller_name' => 'MeController',
|
||||
'form' => $form->createView(),
|
||||
'pagination' => $paginator->paginate($user->getDocuments())
|
||||
'pagination' => $paginator->paginate(
|
||||
$user->getDocuments(),
|
||||
$request->query->getInt('page', 1)
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,13 +52,22 @@ class UserController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/view/{id}/sanctions', name: 'view_sanctions')]
|
||||
public function viewSanctions(PaginatorInterface $paginator, User $User): Response
|
||||
public function viewSanctions(PaginatorInterface $paginator, User $User, Request $request): Response
|
||||
{
|
||||
$group = $this->getUser()->getMainGroup();
|
||||
/**
|
||||
* @var User $user
|
||||
*/
|
||||
$user = $this->getUser();
|
||||
|
||||
$group = $user->getMainGroup();
|
||||
|
||||
if (!$this->IsGranted('sanction', $group)) {
|
||||
throw new AccessDeniedHttpException("granted_not_allowed_to_view_sanctions");
|
||||
}
|
||||
$pagination = $paginator->paginate($User->getSanctions());
|
||||
$pagination = $paginator->paginate(
|
||||
$User->getSanctions(),
|
||||
$request->query->getInt('page', 1)
|
||||
);
|
||||
return $this->render('user/sanctions.html.twig', [
|
||||
'controller_name' => 'UserController',
|
||||
'user' => $User,
|
||||
@@ -67,9 +76,12 @@ class UserController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/view/{id}/documents', name: 'view_documents')]
|
||||
public function viewDocuments(PaginatorInterface $paginator, User $User): Response
|
||||
public function viewDocuments(PaginatorInterface $paginator, User $User, Request $request): Response
|
||||
{
|
||||
$pagination = $paginator->paginate($User->getDocuments());
|
||||
$pagination = $paginator->paginate(
|
||||
$User->getDocuments(),
|
||||
$request->query->getInt('page', 1)
|
||||
);
|
||||
return $this->render('user/documents.html.twig', [
|
||||
'controller_name' => 'UserController',
|
||||
'user' => $User,
|
||||
|
||||
@@ -15,7 +15,6 @@ class Template extends Document
|
||||
public function __construct(User $user)
|
||||
{
|
||||
parent::__construct($user);
|
||||
$this->setNeedGroupAdministration(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,8 +26,6 @@ class TestType extends AbstractType
|
||||
*/
|
||||
$User = $this->TokenStorage->getToken()->getUser();
|
||||
|
||||
dd($User);
|
||||
|
||||
$builder
|
||||
->add('title', null, [
|
||||
'label' => 'form_label_title',
|
||||
|
||||
@@ -111,9 +111,6 @@ class PermissionsList
|
||||
}
|
||||
}
|
||||
|
||||
//dd($buildedPermissions);
|
||||
|
||||
|
||||
return $buildedPermissions;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ class DocumentRepositoriesExtension extends ServiceEntityRepository
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!$User->hasPermission('group_ignore_subgroups')) {
|
||||
$this->qb->andWhere('d.allowedSubGroups is empty');
|
||||
foreach ($User->getSubGroups() as $key => $subG) {
|
||||
@@ -76,6 +78,7 @@ class DocumentRepositoriesExtension extends ServiceEntityRepository
|
||||
if (!$User->hasPermission('general_medical_view')) {
|
||||
$this->qb->andWhere('d.needMedicalAccess = 0');
|
||||
}
|
||||
|
||||
if (!$User->hasPermission('group_administrate')) {
|
||||
$this->qb->andWhere('d.needGroupAdministration = 0');
|
||||
}
|
||||
|
||||
22
src/Twig/VersionExtension.php
Normal file
22
src/Twig/VersionExtension.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Twig;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class VersionExtension extends AbstractExtension
|
||||
{
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('vision_version', [$this, 'visionVersion']),
|
||||
];
|
||||
}
|
||||
|
||||
public function visionVersion()
|
||||
{
|
||||
return json_decode(file_get_contents('../package.json'))->version;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user