mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
merge 111_exports_suite into testing branch
This commit is contained in:
@@ -525,6 +525,21 @@ class ExportController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
private function getExportGroup($target): string
|
||||
{
|
||||
$exportManager = $this->exportManager;
|
||||
|
||||
$groups = $exportManager->getExportsGrouped(true);
|
||||
|
||||
foreach ($groups as $group => $array) {
|
||||
foreach ($array as $alias => $export) {
|
||||
if ($export === $target) {
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the next step. If $reverse === true, the previous step is returned.
|
||||
*
|
||||
@@ -572,19 +587,4 @@ class ExportController extends AbstractController
|
||||
throw new LogicException("the step {$step} is not defined.");
|
||||
}
|
||||
}
|
||||
|
||||
private function getExportGroup($target): string
|
||||
{
|
||||
$exportManager = $this->exportManager;
|
||||
|
||||
$groups = $exportManager->getExportsGrouped(true);
|
||||
|
||||
foreach ($groups as $group => $array) {
|
||||
foreach ($array as $alias => $export) {
|
||||
if ($export === $target) {
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\DQL;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\DateDiffFunction;
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\AST\Node;
|
||||
use Doctrine\ORM\Query\AST\PathExpression;
|
||||
use Doctrine\ORM\Query\Lexer;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
@@ -12,7 +20,7 @@ use Doctrine\ORM\Query\SqlWalker;
|
||||
|
||||
/**
|
||||
* Extract postgresql function
|
||||
* https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
|
||||
* https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT.
|
||||
*
|
||||
* Usage : EXTRACT(field FROM timestamp)
|
||||
* TODO allow interval usage -> EXTRACT(field FROM interval)
|
||||
@@ -50,5 +58,4 @@ class Extract extends FunctionNode
|
||||
|
||||
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\DQL;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
@@ -8,7 +17,7 @@ use Doctrine\ORM\Query\Parser;
|
||||
use Doctrine\ORM\Query\SqlWalker;
|
||||
|
||||
/**
|
||||
* Usage : TO_CHAR(datetime, fmt)
|
||||
* Usage : TO_CHAR(datetime, fmt).
|
||||
*/
|
||||
class ToChar extends FunctionNode
|
||||
{
|
||||
@@ -34,5 +43,4 @@ class ToChar extends FunctionNode
|
||||
$this->fmt = $parser->StringExpression();
|
||||
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -139,10 +139,8 @@ interface ExportInterface extends ExportElementInterface
|
||||
|
||||
/**
|
||||
* Return the required Role to execute the Export.
|
||||
*
|
||||
* @return \Symfony\Component\Security\Core\Role\Role
|
||||
*/
|
||||
public function requiredRole();
|
||||
public function requiredRole(): string;
|
||||
|
||||
/**
|
||||
* Inform which ModifiersInterface (i.e. AggregatorInterface, FilterInterface)
|
||||
|
@@ -550,7 +550,7 @@ class ExportManager
|
||||
if (null === $centers) {
|
||||
$centers = $this->authorizationHelper->getReachableCenters(
|
||||
$this->user,
|
||||
$role->getRole(),
|
||||
$role
|
||||
);
|
||||
}
|
||||
|
||||
@@ -559,13 +559,13 @@ class ExportManager
|
||||
}
|
||||
|
||||
foreach ($centers as $center) {
|
||||
if ($this->authorizationChecker->isGranted($role->getRole(), $center) === false) {
|
||||
if ($this->authorizationChecker->isGranted($role, $center) === false) {
|
||||
//debugging
|
||||
$this->logger->debug('user has no access to element', [
|
||||
'method' => __METHOD__,
|
||||
'type' => get_class($element),
|
||||
'center' => $center->getName(),
|
||||
'role' => $role->getRole(),
|
||||
'role' => $role,
|
||||
]);
|
||||
|
||||
///// Bypasse les autorisations qui empêche d'afficher les nouveaux exports
|
||||
@@ -594,7 +594,7 @@ class ExportManager
|
||||
'center' => $center,
|
||||
'circles' => $this->authorizationHelper->getReachableScopes(
|
||||
$this->user,
|
||||
$element->requiredRole()->getRole(),
|
||||
$element->requiredRole(),
|
||||
$center
|
||||
),
|
||||
];
|
||||
|
@@ -26,9 +26,9 @@ interface ModifierInterface extends ExportElementInterface
|
||||
* If null, will used the ExportInterface::requiredRole role from
|
||||
* the current executing export.
|
||||
*
|
||||
* @return \Symfony\Component\Security\Core\Role\Role|null A role required to execute this ModifiersInterface
|
||||
* @return string|null A role required to execute this ModifiersInterface
|
||||
*/
|
||||
public function addRole();
|
||||
public function addRole(): ?string;
|
||||
|
||||
/**
|
||||
* Alter the query initiated by the export, to add the required statements
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Main;
|
||||
@@ -8,10 +15,16 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add new entity GeographicalUnit
|
||||
* Add new entity GeographicalUnit.
|
||||
*/
|
||||
final class Version20220829132409 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_main_geographical_unit_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_main_geographical_unit');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add new entity GeographicalUnit';
|
||||
@@ -22,10 +35,4 @@ final class Version20220829132409 extends AbstractMigration
|
||||
$this->addSql('CREATE SEQUENCE chill_main_geographical_unit_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_main_geographical_unit (id INT NOT NULL, geom TEXT DEFAULT NULL, layerName VARCHAR(255) DEFAULT NULL, unitName VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_main_geographical_unit_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_main_geographical_unit');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user