Commit 11640ac7 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction bug Doctrine limite 30 caractères

WIP nouveau UserManager
parent 530fbe94
Loading
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -9,17 +9,13 @@
echo '<br /><br /><br /><br /><br /><br /><br />';

$um = $container->get(\Framework\User\UserManager::class);
dump($um->getCurrent());
dump($um->getCurrentProfile());
$um->updatePrivileges();
dump($um->getPrivileges());

$intervenant = $um->getCurrentProfile()->getContext('intervenant');

dump($intervenant->getId());

$ldap = $container->get(\Utilisateur\Connecteur\LdapConnecteur::class);

dump($ldap->getUtilisateurCourantCode());



$a = $container->get(\Laminas\Authentication\AuthenticationService::class);
$c = $a->getIdentity();

dump($c);
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ return [
        'connection'    => [
            'orm_default' => [
                'params' => [
                    'driverClass'   => \Doctrine\DBAL\Driver\OCI8\Driver::class,
                    'driverClass'   => \Application\ORM\OracleDriver::class,
                    'host'          => $config['bdd']['host'] ?? null,
                    'port'          => $config['bdd']['port'] ?? null,
                    'dbname'        => $config['bdd']['dbname'] ?? null,
+57 −0
Original line number Diff line number Diff line
<?php

namespace Application\ORM;

use \Doctrine\DBAL\Driver\AbstractOracleDriver;
use Doctrine\DBAL\Driver\OCI8\Connection;
use Doctrine\DBAL\Driver\OCI8\Exception\ConnectionFailed;
use Doctrine\DBAL\Driver\OCI8\Exception\InvalidConfiguration;

class OracleDriver extends AbstractOracleDriver
{
    /**
     * {@inheritDoc}
     *
     * @return Connection
     */
    public function connect(
        #[SensitiveParameter]
        array $params
    ) {
        $username    = $params['user'] ?? '';
        $password    = $params['password'] ?? '';
        $charset     = $params['charset'] ?? '';
        $sessionMode = $params['sessionMode'] ?? OCI_NO_AUTO_COMMIT;

        $connectionString = $this->getEasyConnectString($params);

        $persistent = ! empty($params['persistent']);
        $exclusive  = ! empty($params['driverOptions']['exclusive']);

        if ($persistent && $exclusive) {
            throw InvalidConfiguration::forPersistentAndExclusive();
        }

        if ($persistent) {
            $connection = @oci_pconnect($username, $password, $connectionString, $charset, $sessionMode);
        } elseif ($exclusive) {
            $connection = @oci_new_connect($username, $password, $connectionString, $charset, $sessionMode);
        } else {
            $connection = @oci_connect($username, $password, $connectionString, $charset, $sessionMode);
        }

        if ($connection === false) {
            throw ConnectionFailed::new();
        }

        return new Connection($connection);
    }



    public function getDatabasePlatform()
    {
        return new OraclePlatform();
    }

}
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
<?php

namespace Application\ORM;

use Doctrine\DBAL\Platforms\OraclePlatform as DoctrineOraclePlatform;

class OraclePlatform extends DoctrineOraclePlatform
{
    public function getMaxIdentifierLength()
    {
        return 100;
    }

}
+5 −5
Original line number Diff line number Diff line
@@ -68,8 +68,8 @@ class LayoutViewHelper extends AbstractHtmlElement
            return ['connecte' => false];
        }

        $user = $this->userManager->getCurrent();
        $profile = $this->userManager->getCurrentProfile();
        $user = $this->userManager->getUser();
        $profile = $this->userManager->getProfile();
        $needStructures = false;
        $roles = [];

@@ -81,7 +81,7 @@ class LayoutViewHelper extends AbstractHtmlElement
            if (!$needStructures && $r?->getPeutChangerStructure()) {
                $needStructures = true;
            }
            $roles[$p->getCode()] = [
            $roles[$p->getId()] = [
                'libelle'              => $p->getDisplayName(),
                'peutChangerStructure' => $r?->getPeutChangerStructure() ?? false,
            ];
@@ -94,8 +94,8 @@ class LayoutViewHelper extends AbstractHtmlElement

        return [
            'utilisateurNom'    => $user->getDisplayName(),
            'roleNom'           => $profile->getDisplayName(),
            'roleId'            => $profile->getCode(),
            'roleNom'           => $profile?->getDisplayName() ?? 'Authentifié(e)',
            'roleId'            => $profile?->getId(),
            'connecte'          => true,
            'usurpationEnabled' => $this->isUsurpationEnabled(),
            'usurpationEnCours' => $this->isUsurpationEnCours(),
Loading