src/Entity/StbUser.php line 746

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Utility\DateUtils;
  4. use DateTime;
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. class StbUser extends AbstractEntityBase implements UserInterface {
  7.     /**
  8.      * @var string
  9.      */
  10.     private $username;
  11.     /**
  12.      * @var string
  13.      */
  14.     private $password;
  15.     private $currentPassword;
  16.     /**
  17.      * @var string
  18.      */
  19.     private $fullName;
  20.     /**
  21.      * @var DateTime
  22.      */
  23.     private $lastAccessDatetime;
  24.     private $mainRole;
  25.     private $flagPasswordExpiring;
  26.     private $roles = [];
  27.     private $keyGroup;
  28.     private $userCode;
  29.     private $profileDb;
  30.     private $codMdep;
  31.     /**
  32.      * @var DateTime
  33.      */
  34.     private $passwordEndtime;
  35.     private $codLang;
  36.     /**
  37.      * @var DateTime
  38.      */
  39.     private $creationDatetime;
  40.     private $ctrlState;
  41.     private $details;
  42.     private $eMail;
  43.     private $lastPasswords;
  44.     private $passwordExpiresDays;
  45.     private $urlCss;
  46.     private $insertStbUser;
  47.     /**
  48.      * @var DateTime
  49.      */
  50.     private $destructionDatetime;
  51.     private $wtbClie;
  52.     private $wtbFavoriteArt;
  53.     private $stbUser;
  54.     private $wrlUsersFasi;
  55.     /**
  56.      * @var string
  57.      */
  58.     private $codCal null;
  59.     /**
  60.      * @var string
  61.      */
  62.     private $companyname null;
  63.     /**
  64.      * @var string
  65.      */
  66.     private $flagAttivo null;
  67.     /**
  68.      * @var string
  69.      */
  70.     private $flagDba null;
  71.     /**
  72.      * @var string
  73.      */
  74.     private $flagExtraUser null;
  75.     /**
  76.      * @var string
  77.      */
  78.     private $flagIntraUser null;
  79.     /**
  80.      * @var DateTime
  81.      */
  82.     private $lastDownload null;
  83.     /**
  84.      * @var DateTime
  85.      */
  86.     private $lastUpgDb null;
  87.     /**
  88.      * @var DateTime
  89.      */
  90.     private $lastUpgSp null;
  91.     /**
  92.      * @var string
  93.      */
  94.     private $logoUser null;
  95.     /**
  96.      * @var string
  97.      */
  98.     private $precode null;
  99.     /**
  100.      * @var string
  101.      */
  102.     private $userId null;
  103.     /**
  104.      * @var string
  105.      */
  106.     private $userNameRif null;
  107.     /**
  108.      * @var boolean
  109.      */
  110.     private $cryptPassword true;
  111.     /**
  112.      * @var string
  113.      */
  114.     private $credentials;
  115.     /**
  116.      * @return mixed
  117.      */
  118.     public function getFullName() {
  119.         return $this->fullName;
  120.     }
  121.     /**
  122.      * @param mixed $fullName
  123.      */
  124.     public function setFullName($fullName): void {
  125.         $this->fullName $fullName;
  126.     }
  127.     /**
  128.      * @return mixed
  129.      */
  130.     public function getLastAccessDatetime() {
  131.         return $this->lastAccessDatetime;
  132.     }
  133.     /**
  134.      * @param mixed $lastAccessDatetime
  135.      */
  136.     public function setLastAccessDatetime($lastAccessDatetime): void {
  137.         $this->lastAccessDatetime $lastAccessDatetime;
  138.     }
  139.     /**
  140.      * @return mixed
  141.      */
  142.     public function getFlagPasswordExpiring() {
  143.         return $this->flagPasswordExpiring;
  144.     }
  145.     /**
  146.      * @param mixed $flagPasswordExpiring
  147.      */
  148.     public function setFlagPasswordExpiring($flagPasswordExpiring): void {
  149.         $this->flagPasswordExpiring $flagPasswordExpiring;
  150.     }
  151.     /**
  152.      * @return mixed
  153.      */
  154.     public function getKeyGroup() {
  155.         return $this->keyGroup;
  156.     }
  157.     /**
  158.      * @param mixed $keyGroup
  159.      */
  160.     public function setKeyGroup($keyGroup): void {
  161.         $this->keyGroup $keyGroup;
  162.     }
  163.     /**
  164.      * @return string
  165.      */
  166.     public function getCodCal(): ?string {
  167.         return $this->codCal;
  168.     }
  169.     /**
  170.      * @param string $codCal
  171.      */
  172.     public function setCodCal(?string $codCal): void {
  173.         $this->codCal $codCal;
  174.     }
  175.     /**
  176.      * @return string
  177.      */
  178.     public function getCompanyname(): ?string {
  179.         return $this->companyname;
  180.     }
  181.     /**
  182.      * @param string $companyname
  183.      */
  184.     public function setCompanyname(?string $companyname): void {
  185.         $this->companyname $companyname;
  186.     }
  187.     /**
  188.      * @return string
  189.      */
  190.     public function getFlagDba(): ?string {
  191.         return $this->flagDba;
  192.     }
  193.     /**
  194.      * @param string $flagDba
  195.      */
  196.     public function setFlagDba(?string $flagDba): void {
  197.         $this->flagDba $flagDba;
  198.     }
  199.     /**
  200.      * @return string
  201.      */
  202.     public function getFlagExtraUser(): ?string {
  203.         return $this->flagExtraUser;
  204.     }
  205.     /**
  206.      * @param string $flagExtraUser
  207.      */
  208.     public function setFlagExtraUser(?string $flagExtraUser): void {
  209.         $this->flagExtraUser $flagExtraUser;
  210.     }
  211.     /**
  212.      * @return string
  213.      */
  214.     public function getFlagIntraUser(): ?string {
  215.         return $this->flagIntraUser;
  216.     }
  217.     /**
  218.      * @param string $flagIntraUser
  219.      */
  220.     public function setFlagIntraUser(?string $flagIntraUser): void {
  221.         $this->flagIntraUser $flagIntraUser;
  222.     }
  223.     /**
  224.      * @return DateTime
  225.      */
  226.     public function getLastDownload(): ?DateTime {
  227.         return $this->lastDownload;
  228.     }
  229.     /**
  230.      * @param DateTime $lastDownload
  231.      */
  232.     public function setLastDownload(?DateTime $lastDownload): void {
  233.         $this->lastDownload $lastDownload;
  234.     }
  235.     /**
  236.      * @return DateTime
  237.      */
  238.     public function getLastUpgDb(): ?DateTime {
  239.         return $this->lastUpgDb;
  240.     }
  241.     /**
  242.      * @param DateTime $lastUpgDb
  243.      */
  244.     public function setLastUpgDb(?DateTime $lastUpgDb): void {
  245.         $this->lastUpgDb $lastUpgDb;
  246.     }
  247.     /**
  248.      * @return DateTime
  249.      */
  250.     public function getLastUpgSp(): ?DateTime {
  251.         return $this->lastUpgSp;
  252.     }
  253.     /**
  254.      * @param DateTime $lastUpgSp
  255.      */
  256.     public function setLastUpgSp(?DateTime $lastUpgSp): void {
  257.         $this->lastUpgSp $lastUpgSp;
  258.     }
  259.     /**
  260.      * @return string
  261.      */
  262.     public function getLogoUser(): ?string {
  263.         return $this->logoUser;
  264.     }
  265.     /**
  266.      * @param string $logoUser
  267.      */
  268.     public function setLogoUser(?string $logoUser): void {
  269.         $this->logoUser $logoUser;
  270.     }
  271.     /**
  272.      * @return string
  273.      */
  274.     public function getPrecode(): ?string {
  275.         return $this->precode;
  276.     }
  277.     /**
  278.      * @param string $precode
  279.      */
  280.     public function setPrecode(?string $precode): void {
  281.         $this->precode $precode;
  282.     }
  283.     /**
  284.      * @return string
  285.      */
  286.     public function getUserId(): ?string {
  287.         return $this->userId;
  288.     }
  289.     /**
  290.      * @param string $userId
  291.      */
  292.     public function setUserId(?string $userId): void {
  293.         $this->userId $userId;
  294.     }
  295.     /**
  296.      * @return string
  297.      */
  298.     public function getUserNameRif(): ?string {
  299.         return $this->userNameRif;
  300.     }
  301.     /**
  302.      * @param string $userNameRif
  303.      */
  304.     public function setUserNameRif(?string $userNameRif): void {
  305.         $this->userNameRif $userNameRif;
  306.     }
  307.     /**
  308.      * @return bool
  309.      */
  310.     public function isCryptPassword(): bool {
  311.         return $this->cryptPassword;
  312.     }
  313.     /**
  314.      * @param bool $cryptPassword
  315.      */
  316.     public function setCryptPassword(bool $cryptPassword): void {
  317.         $this->cryptPassword $cryptPassword;
  318.     }
  319.     public function getRoles() {
  320.         $roles $this->roles;
  321.         // guarantee every user at least has ROLE_USER
  322.         switch ($this->keyGroup) {
  323.             case 1:
  324.                 $roles[] = 'ROLE_SUPER_ADMIN';
  325.                 break;
  326.             case 2:
  327.                 $roles[] = 'ROLE_USER_ADV';
  328.                 break;
  329.             case 3:
  330.                 $roles[] = 'ROLE_CUSTOMER';
  331.                 break;
  332.             case 4:
  333.                 $roles[] = 'ROLE_SUPPLIER';
  334.                 break;
  335.             case 5:
  336.                 $roles[] = 'ROLE_AGENT';
  337.                 break;
  338.             case 6:
  339.                 $roles[] = 'ROLE_INSPECTOR';
  340.                 break;
  341.             case 7:
  342.                 $roles[] = 'ROLE_EXTERNAL_DEPOSIT_MANAGER';
  343.                 break;
  344.             case 8:
  345.                 $roles[] = 'ROLE_WORK_TEAM';
  346.                 break;
  347.             case 9:
  348.                 $roles[] = 'ROLE_ADMIN';
  349.                 break;
  350.             case 10:
  351.                 $roles[] = 'ROLE_PV';
  352.                 break;
  353.             case 11:
  354.                 $roles[] = 'ROLE_PRODUCTION_MANAGER';
  355.                 break;
  356.             case 12:
  357.                 $roles[] = 'ROLE_COMMERCIAL_MANAGER';
  358.                 break;
  359.             case 20:
  360.                 $roles[] = 'ROLE_PV_MANAGER';
  361.                 break;
  362.             case 21:
  363.                 $roles[] = 'ROLE_DETECTOR';
  364.                 break;
  365.             case 22:
  366.                 $roles[] = 'ROLE_TECHNICAL';
  367.                 break;
  368.             case 23:
  369.                 $roles[] = 'ROLE_DEPARTMENT_MANAGER';
  370.                 break;
  371.             case 24:
  372.                 $roles[] = 'ROLE_PURCHASING_MANAGER';
  373.                 break;
  374.             case 25:
  375.                 $roles[] = 'ROLE_EDP';
  376.                 break;
  377.             case 26:
  378.                 $roles[] = 'ROLE_SUBSCRIBER';
  379.                 break;
  380.             case 27:
  381.                 $roles[] = 'ROLE_GUEST';
  382.                 break;
  383.             default:
  384.                 $roles[] = 'ROLE_USER';
  385.                 break;
  386.         }
  387.         return array_unique($roles);
  388.     }
  389.     public function isFlagAttivo() {
  390.         return $this->flagAttivo;
  391.     }
  392.     /**
  393.      * @param  $flagAttivo
  394.      */
  395.     public function setFlagAttivo($flagAttivo): void {
  396.         $this->flagAttivo $flagAttivo;
  397.     }
  398.     /**
  399.      * @return mixed
  400.      */
  401.     public function getUserCode() {
  402.         return $this->userCode;
  403.     }
  404.     /**
  405.      * @param mixed $userCode
  406.      */
  407.     public function setUserCode($userCode): void {
  408.         $this->userCode $userCode;
  409.     }
  410.     /**
  411.      * @return mixed
  412.      */
  413.     public function getProfileDb() {
  414.         return $this->profileDb;
  415.     }
  416.     /**
  417.      * @param mixed $profileDb
  418.      */
  419.     public function setProfileDb($profileDb): void {
  420.         $this->profileDb $profileDb;
  421.     }
  422.     /**
  423.      * @return mixed
  424.      */
  425.     public function getCodMdep() {
  426.         return $this->codMdep;
  427.     }
  428.     /**
  429.      * @param mixed $codMdep
  430.      */
  431.     public function setCodMdep($codMdep): void {
  432.         $this->codMdep $codMdep;
  433.     }
  434.     public function getPassword() {
  435.         return $this->password;
  436.     }
  437.     public function getSalt() {
  438.         // TODO: Implement getSalt() method.
  439.     }
  440.     public function getUsername() {
  441.         return $this->username;
  442.     }
  443.     public function eraseCredentials() {
  444.         // TODO: Implement eraseCredentials() method.
  445.     }
  446.     /**
  447.      * @param string $username
  448.      */
  449.     public function setUsername($username): void {
  450.         $this->username $username;
  451.     }
  452.     /**
  453.      * @param string|null $password
  454.      */
  455.     public function setPassword(?string $password): void {
  456.         $this->password $password;
  457.     }
  458.     /**
  459.      * @return mixed
  460.      */
  461.     public function getPasswordEndtime() {
  462.         return $this->passwordEndtime;
  463.     }
  464.     /**
  465.      * @param mixed $passwordEndtime
  466.      */
  467.     public function setPasswordEndtime($passwordEndtime): void {
  468.         $this->passwordEndtime $passwordEndtime;
  469.     }
  470.     /**
  471.      * @return mixed
  472.      */
  473.     public function getCodLang() {
  474.         return $this->codLang;
  475.     }
  476.     /**
  477.      * @param mixed $codLang
  478.      */
  479.     public function setCodLang($codLang): void {
  480.         $this->codLang $codLang;
  481.     }
  482.     /**
  483.      * @return mixed
  484.      */
  485.     public function getCreationDatetime() {
  486.         return $this->creationDatetime;
  487.     }
  488.     /**
  489.      * @param mixed $creationDatetime
  490.      */
  491.     public function setCreationDatetime($creationDatetime): void {
  492.         $this->creationDatetime $creationDatetime;
  493.     }
  494.     /**
  495.      * @return mixed
  496.      */
  497.     public function getCtrlState() {
  498.         return $this->ctrlState;
  499.     }
  500.     /**
  501.      * @param mixed $ctrlState
  502.      */
  503.     public function setCtrlState($ctrlState): void {
  504.         $this->ctrlState $ctrlState;
  505.     }
  506.     /**
  507.      * @return mixed
  508.      */
  509.     public function getDetails() {
  510.         return $this->details;
  511.     }
  512.     /**
  513.      * @param mixed $details
  514.      */
  515.     public function setDetails($details): void {
  516.         $this->details $details;
  517.     }
  518.     /**
  519.      * @return mixed
  520.      */
  521.     public function getEMail() {
  522.         return $this->eMail;
  523.     }
  524.     /**
  525.      * @param mixed $eMail
  526.      */
  527.     public function setEMail($eMail): void {
  528.         $this->eMail $eMail;
  529.     }
  530.     /**
  531.      * @return mixed
  532.      */
  533.     public function getLastPasswords() {
  534.         return $this->lastPasswords;
  535.     }
  536.     /**
  537.      * @param mixed $lastPasswords
  538.      */
  539.     public function setLastPasswords($lastPasswords): void {
  540.         $this->lastPasswords $lastPasswords;
  541.     }
  542.     /**
  543.      * @return mixed
  544.      */
  545.     public function getPasswordExpiresDays() {
  546.         return $this->passwordExpiresDays;
  547.     }
  548.     /**
  549.      * @param mixed $passwordExpiresDays
  550.      */
  551.     public function setPasswordExpiresDays($passwordExpiresDays): void {
  552.         $this->passwordExpiresDays $passwordExpiresDays;
  553.     }
  554.     /**
  555.      * @return mixed
  556.      */
  557.     public function getUrlCss() {
  558.         return $this->urlCss;
  559.     }
  560.     /**
  561.      * @param mixed $urlCss
  562.      */
  563.     public function setUrlCss($urlCss): void {
  564.         $this->urlCss $urlCss;
  565.     }
  566.     /**
  567.      * @return mixed
  568.      */
  569.     public function getInsertStbUser() {
  570.         return $this->insertStbUser;
  571.     }
  572.     /**
  573.      * @param mixed $insertStbUser
  574.      */
  575.     public function setInsertStbUser($insertStbUser): void {
  576.         $this->insertStbUser $insertStbUser;
  577.     }
  578.     /**
  579.      * @return mixed
  580.      */
  581.     public function getDestructionDatetime() {
  582.         return $this->destructionDatetime;
  583.     }
  584.     /**
  585.      * @param mixed $destructionDatetime
  586.      */
  587.     public function setDestructionDatetime($destructionDatetime): void {
  588.         $this->destructionDatetime $destructionDatetime;
  589.     }
  590.     /**
  591.      * @return mixed
  592.      */
  593.     public function getWtbClie() {
  594.         return $this->wtbClie;
  595.     }
  596.     /**
  597.      * @param mixed $wtbClie
  598.      */
  599.     public function setWtbClie($wtbClie): void {
  600.         $this->wtbClie $wtbClie;
  601.     }
  602.     /**
  603.      * @return mixed
  604.      */
  605.     public function getWtbFavoriteArt() {
  606.         return $this->wtbFavoriteArt;
  607.     }
  608.     /**
  609.      * @param mixed $wtbFavoriteArt
  610.      */
  611.     public function setWtbFavoriteArt($wtbFavoriteArt): void {
  612.         $this->wtbFavoriteArt $wtbFavoriteArt;
  613.     }
  614.     /**
  615.      * @return mixed
  616.      */
  617.     public function getStbUser() {
  618.         return $this->stbUser;
  619.     }
  620.     /**
  621.      * @param mixed $stbUser
  622.      */
  623.     public function setStbUser($stbUser): void {
  624.         $this->stbUser $stbUser;
  625.     }
  626.     /**
  627.      * @return mixed
  628.      */
  629.     public function getWrlUsersFasi() {
  630.         return $this->wrlUsersFasi;
  631.     }
  632.     /**
  633.      * @param mixed $wrlUsersFasi
  634.      */
  635.     public function setWrlUsersFasi($wrlUsersFasi): void {
  636.         $this->wrlUsersFasi $wrlUsersFasi;
  637.     }
  638.     /**
  639.      * @return mixed
  640.      */
  641.     public function getCurrentPassword() {
  642.         return $this->currentPassword;
  643.     }
  644.     /**
  645.      * @param mixed $currentPassword
  646.      */
  647.     public function setCurrentPassword($currentPassword): void {
  648.         $this->currentPassword $currentPassword;
  649.     }
  650.     public function jsonSerialize() {
  651.         return [
  652.             "operation" => $this->getOperation(),
  653.             "type" => $this->getType(),
  654.             'userName' => $this->getUsername(),
  655.             'fullName' => $this->getFullName(),
  656.             'password' => $this->getPassword(),
  657.             'lastAccessDatetime' => $this->getLastAccessDatetime() ? $this->getLastAccessDatetime()->format(DateUtils::FORMAT_DATETIME_FOR_REST) : null,
  658.             'flagPasswordExpiring' => $this->getFlagPasswordExpiring() ? "S" "N",
  659.             "codMdep" => $this->getCodMdep(),
  660.             "profileDb" => $this->getProfileDb(),
  661.             "passwordEndtime" => $this->getPasswordEndtime() ? $this->getPasswordEndtime()->format(DateUtils::FORMAT_DATETIME_FOR_REST) : null,
  662.             "userCode" => $this->getUserCode(),
  663.             "username" => $this->getUsername(),
  664.             "keyGroup" => $this->getKeyGroup(),
  665.             "codLang" => $this->getcodLang(),
  666.             "creationDatetime" => $this->getCreationDatetime() ? $this->getCreationDatetime()->format(DateUtils::FORMAT_DATETIME_FOR_REST) : null,
  667.             "ctrlState" => $this->getCtrlState() ? "S" "N",
  668.             "details" => $this->getDetails(),
  669.             "eMail" => $this->getEMail(),
  670.             "lastPasswords" => $this->getLastPasswords(),
  671.             "passwordExpiresDays" => $this->getPasswordExpiresDays(),
  672.             "urlCss" => $this->getUrlCss(),
  673.             "codCal" => $this->getCodCal(),
  674.             "companyname" => $this->getCompanyname(),
  675.             "flagAttivo" => $this->isflagAttivo(),
  676.             "flagDba" => $this->getFlagDba(),
  677.             "flagExtraUser" => $this->getFlagExtraUser(),
  678.             "flagIntraUser" => $this->getFlagIntraUser(),
  679.             "lastDownload" => $this->getLastDownload(),
  680.             "lastUpgDb" => $this->getLastUpgDb(),
  681.             "lastUpgSp" => $this->getLastUpgSp(),
  682.             "logoUser" => $this->getLogoUser(),
  683.             "precode" => $this->getPrecode(),
  684.             "userId" => $this->getUserId(),
  685.             "userNameRif" => $this->getUserNameRif(),
  686.             "cryptPassword" => $this->isCryptPassword(),
  687.         ];
  688.     }
  689.     public function fromDto($dto) {
  690.         $this->fullName $dto["full_name"];
  691.         $this->codMdep $dto["cod_mdep"];
  692.         $this->profileDb $dto["profile_db"];
  693.         $this->passwordEndtime $dto["password_endtime"] ? DateUtils::fromDatestring($dto["password_endtime"]) : null;
  694.         $this->userCode $dto["user_code"];
  695. //        $this->flagAttivo = $dto["flag_attivo"] === "S";
  696.         $this->username $dto["user_name"];
  697.         $this->flagPasswordExpiring $dto["flag_password_expiring"] === "S";
  698.         $this->lastAccessDatetime DateUtils::fromDatestring($dto["Last_access_datetime"]);
  699.         $this->keyGroup $dto["key_group"];
  700.         $this->codLang $dto["cod_lang"];
  701.         $this->creationDatetime array_key_exists("creation_datetime"$dto) && $dto["creation_datetime"] ? $dto["creation_datetime"] : null;
  702.         $this->ctrlState = !(array_key_exists("ctrl_state"$dto) && $dto["ctrl_state"]) || $dto["ctrl_state"] == "S";
  703.         $this->details array_key_exists("details"$dto) && $dto["details"] ? $dto["details"] : null;
  704.         $this->eMail array_key_exists("e_mail"$dto) && $dto["e_mail"] ? $dto["e_mail"] : null;
  705.         $this->lastPasswords array_key_exists("lastPasswords"$dto) && $dto["lastPasswords"] ? $dto["lastPasswords"] : null;
  706.         $this->passwordExpiresDays array_key_exists("passwordExpiresDays"$dto) && $dto["passwordExpiresDays"] ? $dto["passwordExpiresDays"] : null;
  707.         $this->urlCss array_key_exists("urlCss"$dto) && $dto["urlCss"] ? $dto["urlCss"] : null;
  708.         $this->codCal array_key_exists("codCal"$dto) && $dto["codCal"] ? $dto["codCal"] : null;
  709.         $this->companyname array_key_exists("companyname"$dto) && $dto["companyname"] ? $dto["companyname"] : null;
  710.         $this->flagAttivo array_key_exists("flagAttivo"$dto) && $dto["flagAttivo"] ? $dto["flagAttivo"] : null;
  711.         $this->flagDba array_key_exists("flagDba"$dto) && $dto["flagDba"] ? $dto["flagDba"] : null;
  712.         $this->flagExtraUser array_key_exists("flagExtraUser"$dto) && $dto["flagExtraUser"] ? $dto["flagExtraUser"] : null;
  713.         $this->flagIntraUser array_key_exists("flagIntraUser"$dto) && $dto["flagIntraUser"] ? $dto["flagIntraUser"] : null;
  714.         $this->lastDownload array_key_exists("lastDownload"$dto) && $dto["lastDownload"] ? $dto["lastDownload"] : null;
  715.         $this->lastUpgDb array_key_exists("lastUpgDb"$dto) && $dto["lastUpgDb"] ? $dto["lastUpgDb"] : null;
  716.         $this->lastUpgSp array_key_exists("lastUpgSp"$dto) && $dto["lastUpgSp"] ? $dto["lastUpgSp"] : null;
  717.         $this->logoUser array_key_exists("logoUser"$dto) && $dto["logoUser"] ? $dto["logoUser"] : null;
  718.         $this->precode array_key_exists("precode"$dto) && $dto["precode"] ? $dto["precode"] : null;
  719.         $this->userId array_key_exists("userId"$dto) && $dto["userId"] ? $dto["userId"] : null;
  720.         $this->userNameRif array_key_exists("userNameRif"$dto) && $dto["userNameRif"] ? $dto["userNameRif"] : null;
  721.         $this->cryptPassword array_key_exists("cryptPassword"$dto) && $dto["cryptPassword"] && boolval($dto["cryptPassword"]);
  722.     }
  723.     public function getLocale() {
  724.         return $this->getCodLang() ? strtolower($this->getCodLang()) : "en";
  725.     }
  726.     public function getType() {
  727.         return "stb_user";
  728.     }
  729.     /**
  730.      * @return mixed
  731.      */
  732.     public function getMainRole() {
  733.         $role "Utente";
  734.         switch ($this->keyGroup) {
  735.             case 1:
  736.                 $role 'Super amministratore';
  737.                 break;
  738.             case 2:
  739.                 $role 'Utente aziendale';
  740.                 break;
  741.             case 3:
  742.                 $role 'Cliente';
  743.                 break;
  744.             case 4:
  745.                 $role 'Fornitore';
  746.                 break;
  747.             case 5:
  748.                 $role 'Agente';
  749.                 break;
  750.             case 6:
  751.                 $role 'Ispettore';
  752.                 break;
  753.             case 7:
  754.                 $role 'Gestore deposito esterno';
  755.                 break;
  756.             case 8:
  757.                 $role 'Squadra lavoro';
  758.                 break;
  759.             case 9:
  760.                 $role 'Amministratore';
  761.                 break;
  762.             case 10:
  763.                 $role 'Punto vendita';
  764.                 break;
  765.             case 11:
  766.                 $role 'Responsabile produzione';
  767.                 break;
  768.             case 12:
  769.                 $role 'Responsabile commerciale';
  770.                 break;
  771.             case 20:
  772.                 $role 'Responsabile magazzino';
  773.                 break;
  774.             case 21:
  775.                 $role 'Rilevatore';
  776.                 break;
  777.             case 22:
  778.                 $role 'Tecnico';
  779.                 break;
  780.             case 23:
  781.                 $role 'Responsabile Reparto';
  782.                 break;
  783.             case 24:
  784.                 $role 'Responsabile acquisti';
  785.                 break;
  786.             case 25:
  787.                 $role 'EDP';
  788.                 break;
  789.             case 26:
  790.                 $role 'Iscritto';
  791.                 break;
  792.             case 27:
  793.                 $role 'Osipte';
  794.                 break;
  795.             default:
  796.                 $role 'Utente';
  797.                 break;
  798.         }
  799.         return $role;
  800.     }
  801.     /**
  802.      * @return mixed
  803.      */
  804.     public function getCredentials() {
  805.         return $this->credentials;
  806.     }
  807.     /**
  808.      * @param mixed $credentials
  809.      */
  810.     public function setCredentials($credentials): void {
  811.         $this->credentials $credentials;
  812.     }
  813.     public function getAuthCredentials() {
  814.         return base64_encode($this->getUsername()) . "::" $this->getCredentials();
  815.     }
  816. }