Daniel 2 anni fa
parent
commit
419380de3f
22 ha cambiato i file con 681 aggiunte e 526 eliminazioni
  1. +82
    -1
      .idea/spt-crm-backend.iml
  2. +3
    -0
      httpdocs/composer.json
  3. +354
    -2
      httpdocs/composer.lock
  4. +1
    -0
      httpdocs/config/bundles.php
  5. +5
    -0
      httpdocs/config/packages/debug.yaml
  6. +1
    -0
      httpdocs/config/packages/doctrine.yaml
  7. +5
    -0
      httpdocs/config/packages/security.yaml
  8. +4
    -2
      httpdocs/src/Controller/PublicController.php
  9. +7
    -15
      httpdocs/src/Entity/EntCountry.php
  10. +22
    -60
      httpdocs/src/Entity/EntCustomer.php
  11. +23
    -63
      httpdocs/src/Entity/EntCustomerContact.php
  12. +34
    -93
      httpdocs/src/Entity/EntCustomerMeeting.php
  13. +9
    -16
      httpdocs/src/Entity/EntCustomerMeetingParticipant.php
  14. +22
    -60
      httpdocs/src/Entity/EntCustomerNote.php
  15. +17
    -42
      httpdocs/src/Entity/EntInternalMeeting.php
  16. +9
    -16
      httpdocs/src/Entity/EntInternalMeetingParticipant.php
  17. +7
    -15
      httpdocs/src/Entity/EntMeetingType.php
  18. +33
    -76
      httpdocs/src/Entity/EntUser.php
  19. +6
    -12
      httpdocs/src/Entity/EntUserType.php
  20. +22
    -43
      httpdocs/src/Security/JsonAuthenticator.php
  21. +3
    -10
      httpdocs/src/Utils/Config.php
  22. +12
    -0
      httpdocs/symfony.lock

+ 82
- 1
.idea/spt-crm-backend.iml Vedi File

@@ -1,7 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/dbal" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/simple-cache" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/sql-formatter" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/log" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/orm" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/migrations" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/http-kernel" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/dependency-injection" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/doctrine-migrations-bundle" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/phenx/php-font-lib" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/yaml" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/event-manager" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/dotenv" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/doctrine-bridge" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/sabberworm/php-css-parser" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/security-bundle" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/runtime" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/egulias/email-validator" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/string" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/service-contracts" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/markbaker/complex" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/http-message" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/var-exporter" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/masterminds/html5" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/flex" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/cache-contracts" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/mailer" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/security-http" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/persistence" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/http-factory" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/framework-bundle" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/var-dumper" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/common" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/security-core" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/sensio/framework-extra-bundle" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/filesystem" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/http-client" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/lexer" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/annotations" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/maennchen/zipstream-php" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/mime" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/event-dispatcher-contracts" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/instantiator" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/property-access" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/deprecations" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/stopwatch" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/event-dispatcher" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/polyfill-intl-idn" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/config" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/security-csrf" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/markbaker/matrix" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/routing" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/http-foundation" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/doctrine-bundle" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/polyfill-intl-grapheme" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/cache" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/console" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/container" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/phenx/php-svg-lib" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/myclabs/php-enum" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/polyfill-intl-normalizer" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/dompdf/dompdf" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/collections" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/password-hasher" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/property-info" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/deprecation-contracts" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/phpoffice/phpspreadsheet" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/cache" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/cache" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/psr/event-dispatcher" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/finder" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/ezyang/htmlpurifier" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/error-handler" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/doctrine/inflector" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/debug-bundle" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/twig-bridge" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/symfony/translation-contracts" />
<excludeFolder url="file://$MODULE_DIR$/httpdocs/vendor/twig/twig" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>

+ 3
- 0
httpdocs/composer.json Vedi File

@@ -70,5 +70,8 @@
"allow-contrib": false,
"require": "6.2.*"
}
},
"require-dev": {
"symfony/debug-bundle": "6.2.*"
}
}

+ 354
- 2
httpdocs/composer.lock Vedi File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9de26d479d080ba6069e18310ae49ab9",
"content-hash": "15a7bf65293c8d623f82986b5c017838",
"packages": [
{
"name": "doctrine/annotations",
@@ -5813,7 +5813,359 @@
"time": "2023-04-28T13:25:36+00:00"
}
],
"packages-dev": [],
"packages-dev": [
{
"name": "symfony/debug-bundle",
"version": "v6.2.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug-bundle.git",
"reference": "8ff6c96d09c462beade7512137899e400c76d994"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug-bundle/zipball/8ff6c96d09c462beade7512137899e400c76d994",
"reference": "8ff6c96d09c462beade7512137899e400c76d994",
"shasum": ""
},
"require": {
"ext-xml": "*",
"php": ">=8.1",
"symfony/dependency-injection": "^5.4|^6.0",
"symfony/http-kernel": "^5.4|^6.0",
"symfony/twig-bridge": "^5.4|^6.0",
"symfony/var-dumper": "^5.4|^6.0"
},
"conflict": {
"symfony/config": "<5.4",
"symfony/dependency-injection": "<5.4"
},
"require-dev": {
"symfony/config": "^5.4|^6.0",
"symfony/web-profiler-bundle": "^5.4|^6.0"
},
"suggest": {
"symfony/config": "For service container configuration",
"symfony/dependency-injection": "For using as a service from the container"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Symfony\\Bundle\\DebugBundle\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/debug-bundle/tree/v6.2.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-02-14T08:44:56+00:00"
},
{
"name": "symfony/translation-contracts",
"version": "v3.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "02c24deb352fb0d79db5486c0c79905a85e37e86"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86",
"reference": "02c24deb352fb0d79db5486c0c79905a85e37e86",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.4-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Translation\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to translation",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/translation-contracts/tree/v3.3.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-05-30T17:17:10+00:00"
},
{
"name": "symfony/twig-bridge",
"version": "v6.2.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/twig-bridge.git",
"reference": "30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/twig-bridge/zipball/30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927",
"reference": "30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/translation-contracts": "^1.1|^2|^3",
"twig/twig": "^2.13|^3.0.4"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.2.2",
"phpdocumentor/type-resolver": "<1.4.0",
"symfony/console": "<5.4",
"symfony/form": "<6.2.7",
"symfony/http-foundation": "<5.4",
"symfony/http-kernel": "<6.2",
"symfony/mime": "<6.2",
"symfony/translation": "<5.4",
"symfony/workflow": "<5.4"
},
"require-dev": {
"doctrine/annotations": "^1.12|^2",
"egulias/email-validator": "^2.1.10|^3|^4",
"league/html-to-markdown": "^5.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/asset": "^5.4|^6.0",
"symfony/console": "^5.4|^6.0",
"symfony/dependency-injection": "^5.4|^6.0",
"symfony/expression-language": "^5.4|^6.0",
"symfony/finder": "^5.4|^6.0",
"symfony/form": "^6.2.7",
"symfony/html-sanitizer": "^6.1",
"symfony/http-foundation": "^5.4|^6.0",
"symfony/http-kernel": "^6.2",
"symfony/intl": "^5.4|^6.0",
"symfony/mime": "^6.2",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/property-info": "^5.4|^6.0",
"symfony/routing": "^5.4|^6.0",
"symfony/security-acl": "^2.8|^3.0",
"symfony/security-core": "^5.4|^6.0",
"symfony/security-csrf": "^5.4|^6.0",
"symfony/security-http": "^5.4|^6.0",
"symfony/serializer": "^6.2",
"symfony/stopwatch": "^5.4|^6.0",
"symfony/translation": "^5.4|^6.0",
"symfony/web-link": "^5.4|^6.0",
"symfony/workflow": "^5.4|^6.0",
"symfony/yaml": "^5.4|^6.0",
"twig/cssinliner-extra": "^2.12|^3",
"twig/inky-extra": "^2.12|^3",
"twig/markdown-extra": "^2.12|^3"
},
"suggest": {
"symfony/asset": "For using the AssetExtension",
"symfony/expression-language": "For using the ExpressionExtension",
"symfony/finder": "",
"symfony/form": "For using the FormExtension",
"symfony/html-sanitizer": "For using the HtmlSanitizerExtension",
"symfony/http-kernel": "For using the HttpKernelExtension",
"symfony/routing": "For using the RoutingExtension",
"symfony/security-core": "For using the SecurityExtension",
"symfony/security-csrf": "For using the CsrfExtension",
"symfony/security-http": "For using the LogoutUrlExtension",
"symfony/stopwatch": "For using the StopwatchExtension",
"symfony/translation": "For using the TranslationExtension",
"symfony/var-dumper": "For using the DumpExtension",
"symfony/web-link": "For using the WebLinkExtension",
"symfony/yaml": "For using the YamlExtension"
},
"type": "symfony-bridge",
"autoload": {
"psr-4": {
"Symfony\\Bridge\\Twig\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides integration for Twig with various Symfony components",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/twig-bridge/tree/v6.2.8"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-03-31T09:14:44+00:00"
},
{
"name": "twig/twig",
"version": "v3.6.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "106c170d08e8415d78be2d16c3d057d0d108262b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b",
"reference": "106c170d08e8415d78be2d16c3d057d0d108262b",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Twig\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Twig Team",
"role": "Contributors"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "https://twig.symfony.com",
"keywords": [
"templating"
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.6.0"
},
"funding": [
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"time": "2023-05-03T19:06:57+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],


+ 1
- 0
httpdocs/config/bundles.php Vedi File

@@ -6,4 +6,5 @@ return [
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
];

+ 5
- 0
httpdocs/config/packages/debug.yaml Vedi File

@@ -0,0 +1,5 @@
when@dev:
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

+ 1
- 0
httpdocs/config/packages/doctrine.yaml Vedi File

@@ -18,6 +18,7 @@ doctrine:
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
type: attribute

when@test:
doctrine:


+ 5
- 0
httpdocs/config/packages/security.yaml Vedi File

@@ -5,6 +5,9 @@ security:
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
users_in_memory: { memory: null }
app_entity_users:
entity:
class: App\Entity\EntUser
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
@@ -12,6 +15,8 @@ security:
main:
lazy: true
provider: users_in_memory
custom_authenticators:
- App\Security\JsonAuthenticator

# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall


+ 4
- 2
httpdocs/src/Controller/PublicController.php Vedi File

@@ -12,6 +12,7 @@ use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class PublicController extends AbstractController
{
@@ -37,9 +38,10 @@ class PublicController extends AbstractController
}

#[Route('/login', name: 'login')]
public function loginAction()
public function loginAction(AuthenticationUtils $authenticationUtils)
{
$error = $this->get('security.authentication_utils')->getLastAuthenticationError();
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();

$data = [
'error' => $error


+ 7
- 15
httpdocs/src/Entity/EntCountry.php Vedi File

@@ -8,10 +8,8 @@ use Symfony\Component\Config\Definition\Exception\Exception;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="country")
*/
#[ORM\Table(name: 'country')]
#[ORM\Entity]
class EntCountry implements IEntity
{
const COUNTRY_GERMANY_ID = 1;
@@ -29,21 +27,15 @@ class EntCountry implements IEntity
self::COUNTRY_FRANCE_ID => 'Frankreich',
);

/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="string", length=50, nullable=false)
*/
#[ORM\Column(type: 'string', length: 50, nullable: false)]
protected $name;

/**
* @ORM\Column(type="string", length=3)
*/
#[ORM\Column(type: 'string', length: 3)]
protected $iso_code;




+ 22
- 60
httpdocs/src/Entity/EntCustomer.php Vedi File

@@ -8,102 +8,64 @@ use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="customer")
*/
#[ORM\Table(name: 'customer')]
#[ORM\Entity]
class EntCustomer implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $old_plp_id;

/**
* @ORM\Column(type="string", nullable=false)
*/
#[ORM\Column(type: 'string', nullable: false)]
protected $name;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $name_additional;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $consultant_user_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $url;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $fax_no;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: 'text', nullable: true)]
protected $comment;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $active;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $creation_date;

/**


+ 23
- 63
httpdocs/src/Entity/EntCustomerContact.php Vedi File

@@ -10,107 +10,67 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="customer_contact")
*/
#[ORM\Table(name: 'customer_contact')]
#[ORM\Entity]
class EntCustomerContact implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $customer_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="ENUM('male', 'female', 'diverse')")
*/
#[ORM\Column(name: 'gender', type: 'string', columnDefinition: "ENUM('male', 'female', 'diverse')")]
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
#[ORM\Column(type: 'string', nullable: false)]
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $department;

/**
* @ORM\Column(type="date", nullable=true)
*/
#[ORM\Column(type: 'date', nullable: true)]
protected $date_of_birth;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $country_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $comment;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $creation_date;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $is_xmas_mail_recipient = false;

/**


+ 34
- 93
httpdocs/src/Entity/EntCustomerMeeting.php Vedi File

@@ -9,157 +9,98 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="customer_meeting", indexes={@ORM\Index(name="search_customer_idx", columns={"customer_id", "owner_user_id", "customer_contact_id"})})
*/
#[ORM\Table(name: 'customer_meeting')]
#[ORM\Index(name: 'search_customer_idx', columns: ['customer_id', 'owner_user_id', 'customer_contact_id'])]
#[ORM\Entity]
class EntCustomerMeeting implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $customer_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $creation_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $owner_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $meeting_type_id;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $is_option_meeting;

/**
* @ORM\Column(type="string", nullable=false)
*/
#[ORM\Column(type: 'string', nullable: false)]
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: 'text', nullable: true)]
protected $description;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $start_date;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $end_date;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $customer_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
#[ORM\Column(name: 'gender', type: 'string', columnDefinition: "enum('male', 'female', 'diverse')")]
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $department;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $street;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $street_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $zip;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $city;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $country_id;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: 'text', nullable: true)]
protected $report;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $first_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $second_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $report_done;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $report_reminder_sent;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $creation_date;




+ 9
- 16
httpdocs/src/Entity/EntCustomerMeetingParticipant.php Vedi File

@@ -9,28 +9,21 @@ use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="customer_meeting_participant",indexes={@ORM\Index(name="search_participant_idx", columns={"customer_meeting_id", "participant_user_id"})},
* uniqueConstraints={@UniqueConstraint(name="unique_participant", columns={"customer_meeting_id", "participant_user_id"})})
*/
#[ORM\Table(name: 'customer_meeting_participant')]
#[ORM\Index(name: 'search_participant_idx', columns: ['customer_meeting_id', 'participant_user_id'])]
#[UniqueConstraint(name: 'unique_participant', columns: ['customer_meeting_id', 'participant_user_id'])]
#[ORM\Entity]
class EntCustomerMeetingParticipant implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $customer_meeting_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $participant_user_id;




+ 22
- 60
httpdocs/src/Entity/EntCustomerNote.php Vedi File

@@ -9,102 +9,64 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="customer_note")
*/
#[ORM\Table(name: 'customer_note')]
#[ORM\Entity]
class EntCustomerNote implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $customer_id;

/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
protected $customer_contact_id;

/**
* @ORM\Column(name="gender", type="string", columnDefinition="enum('male', 'female', 'diverse')")
*/
#[ORM\Column(name: 'gender', type: 'string', columnDefinition: "enum('male', 'female', 'diverse')")]
protected $gender;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $firstname;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $lastname;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $email;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $phone_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $mobile_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $fax_no;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $department;

/**
* @ORM\Column(type="string", nullable=false)
*/
#[ORM\Column(type: 'string', nullable: false)]
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: 'text', nullable: true)]
protected $comment;

/**
* @ORM\Column(type="date", nullable=false)
*/
#[ORM\Column(type: 'date', nullable: false)]
protected $note_date;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $creation_user_id;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
protected $creation_user_firstname;

/**
* @ORM\Column(type="string", nullable=false)
*/
#[ORM\Column(type: 'string', nullable: false)]
protected $creation_user_lastname;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $creation_date;




+ 17
- 42
httpdocs/src/Entity/EntInternalMeeting.php Vedi File

@@ -9,72 +9,47 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="internal_meeting", indexes={@ORM\Index(name="search_owner_idx", columns={"owner_user_id"})})
*/
#[ORM\Table(name: 'internal_meeting')]
#[ORM\Index(name: 'search_owner_idx', columns: ['owner_user_id'])]
#[ORM\Entity]
class EntInternalMeeting implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $creation_user_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $owner_user_id;

/**
* @ORM\Column(type="string", nullable=false)
*/
#[ORM\Column(type: 'string', nullable: false)]
protected $title;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: 'text', nullable: true)]
protected $description;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $start_date;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $end_date;

/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: 'text', nullable: true)]
protected $report;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $first_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $second_reminder_sent;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected $report_reminder_sent;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $creation_date;




+ 9
- 16
httpdocs/src/Entity/EntInternalMeetingParticipant.php Vedi File

@@ -9,28 +9,21 @@ use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Config\Definition\Exception\Exception;

/**
* @ORM\Entity
* @ORM\Table(name="internal_meeting_participant",indexes={@ORM\Index(name="search_participant_idx", columns={"internal_meeting_id", "participant_user_id"})},
* uniqueConstraints={@UniqueConstraint(name="unique_participant", columns={"internal_meeting_id", "participant_user_id"})})
*/
#[ORM\Table(name: 'internal_meeting_participant')]
#[ORM\Index(name: 'search_participant_idx', columns: ['internal_meeting_id', 'participant_user_id'])]
#[UniqueConstraint(name: 'unique_participant', columns: ['internal_meeting_id', 'participant_user_id'])]
#[ORM\Entity]
class EntInternalMeetingParticipant implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $internal_meeting_id;

/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned" = true})
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['unsigned' => true])]
protected $participant_user_id;




+ 7
- 15
httpdocs/src/Entity/EntMeetingType.php Vedi File

@@ -7,27 +7,19 @@ use App\Utils\Utils;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="meeting_type")
*/
#[ORM\Table(name: 'meeting_type')]
#[ORM\Entity]
class EntMeetingType implements IEntity
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(type="string", nullable=false, unique=true)
*/
#[ORM\Column(type: 'string', nullable: false, unique: true)]
protected $type;

/**
* @ORM\Column(type="string", nullable=false, unique=true)
*/
#[ORM\Column(type: 'string', nullable: false, unique: true)]
protected $name;

private static $cacheMeetingTypesById;


+ 33
- 76
httpdocs/src/Entity/EntUser.php Vedi File

@@ -9,56 +9,43 @@ use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;

#[ORM\Entity()]
class EntUser implements IEntity, UserInterface
#[ORM\Entity]
#[ORM\Table(name: "user")]
class EntUser implements IEntity, UserInterface, PasswordAuthenticatedUserInterface
{
// User id of system
const SYSTEM_USER_ID = 0;

// Costs of password encryption
const CRYPT_COST = 12;

#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[ORM\Column(type: "integer")]
#[ORM\GeneratedValue(strategy: "AUTO")]
protected int $id;

#[ORM\Column(Types::STRING, unique: true)]
#[ORM\Column(type: Types::STRING, unique: true)]
protected string $email;

#[ORM\Column(Types::INTEGER)]
protected int $user_type_id;
#[ORM\Column(type: 'json')]
private array $roles = [];

/**
* @ORM\Column(type="string", length=50, nullable=false)
*/
#[ORM\Column(type: 'string', length: 50, nullable: false)]
protected string $firstname;

/**
* @ORM\Column(type="string", length=50, nullable=false)
*/
#[ORM\Column(type: 'string', length: 50, nullable: false)]
protected string $lastname;

/**
* @ORM\Column(type="string", length=60, nullable=false)
*/
#[ORM\Column(type: 'string', length: 60, nullable: false)]
protected string $password;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected bool $active;

/**
* @ORM\Column(type="boolean", nullable=false)
*/
#[ORM\Column(type: 'boolean', nullable: false)]
protected bool $visible;

/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: 'datetime', nullable: false)]
protected $creation_date;

/**
@@ -68,19 +55,17 @@ class EntUser implements IEntity, UserInterface
* @param $firstName
* @param $lastName
* @param $password
* @param $userTypeId
* @param $userTypeIdCreatingUser
* @param EntUser|null $editingUser
* @throws \Exception
*/
public function __construct(EntityManagerInterface $em, $email, $firstName, $lastName, $password, $userTypeId, $userTypeIdCreatingUser, EntUser $editingUser = null)
public function __construct(EntityManagerInterface $em, $email, $firstName, $lastName, $password, $userTypeIdCreatingUser, EntUser $editingUser = null)
{
// Check email
if (!Utils::validateEmail($em, $email)) {
throw new Exception('invalid or existent email given: '.$email);
}

$this->setUserTypeId($userTypeIdCreatingUser, $userTypeId, $editingUser);

// Check password length
if (!Utils::isValidPasswordLength($password)) {
@@ -88,7 +73,6 @@ class EntUser implements IEntity, UserInterface
}

$this->email = $email;
$this->user_type_id = $userTypeId;
$this->firstname = $firstName;
$this->lastname = $lastName;
$this->password = password_hash($password, PASSWORD_BCRYPT, ["cost" => self::CRYPT_COST]);
@@ -108,7 +92,7 @@ class EntUser implements IEntity, UserInterface
/**
* @return mixed
*/
public function getEmail()
public function getEmail(): string
{
return $this->email;
}
@@ -116,15 +100,7 @@ class EntUser implements IEntity, UserInterface
/**
* @return mixed
*/
public function getUserTypeId()
{
return $this->user_type_id;
}

/**
* @return mixed
*/
public function getFirstname()
public function getFirstname(): string
{
return $this->firstname;
}
@@ -132,7 +108,7 @@ class EntUser implements IEntity, UserInterface
/**
* @return mixed
*/
public function getLastname()
public function getLastname(): string
{
return $this->lastname;
}
@@ -140,7 +116,7 @@ class EntUser implements IEntity, UserInterface
/**
* @return mixed
*/
public function getPassword()
public function getPassword(): ?string
{
return $this->password;
}
@@ -164,7 +140,7 @@ class EntUser implements IEntity, UserInterface
/**
* @return mixed
*/
public function getCreationDate()
public function getCreationDate(): string
{
return $this->creation_date;
}
@@ -178,13 +154,20 @@ class EntUser implements IEntity, UserInterface
return $this->email;
}

/**
* Returns roles as part of UserInterface needed in Symfony
* @return string[]
*/
public function getRoles(): array
{
return EntUserType::getUserRoles($this->user_type_id);
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';

return array_unique($roles);
}

public function setRoles(array $roles): self
{
$this->roles = $roles;

return $this;
}

/**
@@ -217,27 +200,6 @@ class EntUser implements IEntity, UserInterface
*/
public function getSalt() {}

/**
* @param $userTypeIdCreatingUser
* @param $userTypeId
* @param EntUser|null $editingUser
*/
public function setUserTypeId($userTypeIdCreatingUser, $userTypeId, EntUser $editingUser = null): void
{
// Check user type id
if (!EntUserType::isValidUserTypeId($userTypeId)) {
throw new Exception('invalid user type id');
}

// Compare creating user type with this user type
$isEditingUser = is_null($editingUser) ? false : $editingUser->getId() == $this->id;
if (!EntUserType::isHigherUserType($userTypeIdCreatingUser, $userTypeId) && !$isEditingUser) {
throw new Exception('creating user has not enough rights to create this user type');
}
$this->user_type_id = $userTypeId;

}

/**
* Sets email with check on validity and existence
* @param ObjectManager $em
@@ -327,9 +289,6 @@ class EntUser implements IEntity, UserInterface
*/
public function clientMapper(EntityManagerInterface $em, $fullMapping = false)
{
/** @var EntUserType $userType */
$userType = $em->getRepository('App:EntUserType')->find($this->user_type_id);

return [
'id' => $this->id,
'email' => $this->email,
@@ -337,8 +296,6 @@ class EntUser implements IEntity, UserInterface
'lastname' => $this->lastname,
'active' => $this->active,
'visible' => $this->visible,
'v_translated_role' => EntUserType::getTranslatedRole($this->user_type_id),
'v_user_type' => $userType->clientMapper($em, $fullMapping),
];
}



+ 6
- 12
httpdocs/src/Entity/EntUserType.php Vedi File

@@ -7,10 +7,8 @@ use Symfony\Component\Config\Definition\Exception\Exception;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="user_type")
*/
#[ORM\Table(name: 'user_type')]
#[ORM\Entity]
class EntUserType implements IEntity
{
// User type for system
@@ -53,16 +51,12 @@ class EntUserType implements IEntity
self::USER_TYPE_ID_SERVICE => 'Service'
);

/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;

/**
* @ORM\Column(name="type", type="string", nullable=false, unique=true)
*/
#[ORM\Column(name: 'type', type: 'string', nullable: false, unique: true)]
protected $type;




+ 22
- 43
httpdocs/src/Security/JsonAuthenticator.php Vedi File

@@ -10,37 +10,34 @@ namespace App\Security;
use App\Entity\EntUser;
use App\Utils\Config;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;

class JsonAuthenticator extends AbstractGuardAuthenticator
class JsonAuthenticator extends AbstractAuthenticator
{
const LOGIN_FAILED = 0;
const LOGIN_SUCCESS = 1;

private $em;

private $router;

/** @var $user EntUser */
private $user;

/**
* JsonAuthenticator constructor.
* @param $em
* @param EntityManager $em
*/
public function __construct(EntityManager $em, RouterInterface $router)
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
$this->router = $router;
$this->user = null;
}

/**
@@ -48,44 +45,26 @@ class JsonAuthenticator extends AbstractGuardAuthenticator
* used for the request. Returning false will cause this authenticator
* to be skipped.
*/
public function supports(Request $request)
public function supports(Request $request): ?bool
{
if ($request->getPathInfo() != "/login" || !$request->isMethod('POST')) {
return false;
}

return !is_null($request->request->get('email')) &&
!is_null($request->request->get('password'));
}
if ($request->getPathInfo() === "/login" && $request->isMethod('POST')) {
return !is_null($request->request->get('email')) && !is_null($request->request->get('password'));

/**
* Called on every request. Return whatever credentials you want to
* be passed to getUser() as $credentials.
*/
public function getCredentials(Request $request)
{
return [
'email' => $request->request->get('email'),
'password' => $request->request->get('password'),
];
}

public function getUser($credentials, UserProviderInterface $userProvider)
{
$email = $credentials['email'];
$this->user = $this->em->getRepository('App:EntUser')->findOneBy(['email' => $email]);

// if a User object, checkCredentials() is called
return $this->user;
}
return false;
}

public function checkCredentials($credentials, UserInterface $user)
public function authenticate(Request $request): Passport
{
/** @var $user EntUser */
return !is_null($user) && $user->checkPassword($credentials['password']);
$email = $request->request->get('email');
$password = $request->request->get('password');
return new Passport(
new UserBadge($email),
new PasswordCredentials($password)
);
}

public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response
{
// on success, let the request continue
$data = array('message' => 'logged in successfully',
@@ -96,7 +75,7 @@ class JsonAuthenticator extends AbstractGuardAuthenticator
return new JsonResponse($data, Response::HTTP_ACCEPTED);
}

public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
$data = array(
'message' => strtr($exception->getMessageKey(), $exception->getMessageData()),


+ 3
- 10
httpdocs/src/Utils/Config.php Vedi File

@@ -9,23 +9,16 @@
namespace App\Utils;


use App\Entity\EntCadasterGlassSurfaceEntry;
use App\Entity\EntCadasterLocalizationEntry;
use App\Entity\EntCadasterTreeEntry;
use App\Entity\EntCountry;
use App\Entity\EntLocationObject;
use App\Entity\EntQualityRequirementRoom;
use App\Entity\EntUserType;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;

class Config
{
/**
* Returns api config
* @param ObjectManager $em
* @param EntityManagerInterface $em
* @return array
*/
public static function getConfig(ObjectManager $em)
public static function getConfig(EntityManagerInterface $em)
{
return [
'users' => Utils::clientMap($em, $em->getRepository('App:EntUser')->findBy(['visible' => true])),


+ 12
- 0
httpdocs/symfony.lock Vedi File

@@ -59,6 +59,18 @@
"bin/console"
]
},
"symfony/debug-bundle": {
"version": "6.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "5aa8aa48234c8eb6dbdd7b3cd5d791485d2cec4b"
},
"files": [
"config/packages/debug.yaml"
]
},
"symfony/flex": {
"version": "2.2",
"recipe": {


Caricamento…
Annulla
Salva