src/Entity/Idempiere/AdUser.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Idempiere;
  3. use App\Repository\Idempiere\AdUserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. use Symfony\Component\Security\Core\User\UserInterface;
  10. /**
  11.  * @ORM\Entity(repositoryClass=AdUserRepository::class)
  12.  * @ORM\Table(name="AD_User")
  13.  */
  14. class AdUser implements 
  15.     UserInterface
  16.     PasswordAuthenticatedUserInterface,
  17.     PasswordHasherAwareInterface
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $ad_user_id;
  24.     /**
  25.      * @ORM\Column(type="string", length=36)
  26.      */
  27.     private $ad_user_uu;
  28.     /**
  29.      * @ORM\Column(type="integer")
  30.      */
  31.     private $ad_client_id;
  32.     /**
  33.      * @ORM\Column(type="string", length=1)
  34.      */
  35.     private $isactive;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      */
  39.     private $created;
  40.     /**
  41.      * @ORM\Column(type="integer")
  42.      */
  43.     private $createdby;
  44.     /**
  45.      * @ORM\Column(type="datetime")
  46.      */
  47.     private $updated;
  48.     /**
  49.      * @ORM\Column(type="integer")
  50.      */
  51.     private $updatedby;
  52.     /**
  53.      * @ORM\Column(type="string", length=255)
  54.      */
  55.     private $name;
  56.     /**
  57.      * @ORM\Column(type="string", length=255)
  58.      */
  59.     private $description;
  60.     /**
  61.      * @ORM\Column(type="string", length=255)
  62.      */
  63.     private $password;
  64.     /**
  65.      * @ORM\Column(type="string", length=255)
  66.      */
  67.     private $email;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      */
  71.     private $phone;
  72.     /**
  73.      * @ORM\Column(type="datetime", nullable=true)
  74.      */
  75.     private $birthday;
  76.     /**
  77.      * @ORM\Column(type="string", length=255)
  78.      */
  79.     private $salt;
  80.     /**
  81.      * @ORM\Column(type="string", length=1)
  82.      */
  83.     private $islocked;
  84.     /**
  85.      * @ORM\Column(type="datetime", nullable=true)
  86.      */
  87.     private $dateaccountlocked;
  88.     /**
  89.      * @ORM\Column(type="integer")
  90.      */
  91.     private $failedlogincount;
  92.     /**
  93.      * @ORM\Column(type="datetime", nullable=true)
  94.      */
  95.     private $datepasswordchanged;
  96.     /**
  97.      * @ORM\Column(type="datetime", nullable=true)
  98.      */
  99.     private $datelastlogin;
  100.     /**
  101.      * @ORM\Column(type="string", length=1)
  102.      */
  103.     private $isexpired;
  104.     /**
  105.      * @ORM\Column(type="string", length=255, nullable=true)
  106.      */
  107.     private $securityquestion;
  108.     /**
  109.      * @ORM\Column(type="string", length=255, nullable=true)
  110.      */
  111.     private $answer;
  112.     /**
  113.      * @ORM\ManyToOne(targetEntity=CBpartner::class)
  114.      * @ORM\JoinColumn(referencedColumnName="c_bpartner_id", nullable=false)
  115.      */
  116.     private $c_bpartner;
  117.     /**
  118.      * @ORM\Column(type="integer")
  119.      */
  120.     private $c_bpartner_id;
  121.     /**
  122.      * @ORM\ManyToOne(targetEntity=CBpartnerLocation::class)
  123.      * @ORM\JoinColumn(referencedColumnName="c_bpartner_location_id", nullable=false)
  124.      */
  125.     private $c_bpartner_location;
  126.     /**
  127.      * @ORM\Column(type="integer", nullable=true)
  128.      */
  129.     private $c_bpartner_location_id;
  130.     /**
  131.      * @ORM\OneToMany(targetEntity=AdUserRoles::class, mappedBy="ad_user")
  132.      */
  133.     private $ad_user_roles;
  134.     /**
  135.      * @ORM\OneToMany(targetEntity=AdUserOrgaccess::class, mappedBy="ad_user")
  136.      */
  137.     private $ad_user_orgaccesses;
  138.     /**
  139.      * @ORM\ManyToOne(targetEntity=CActivity::class, inversedBy="ad_users")
  140.      * @ORM\JoinColumn(referencedColumnName="c_activity_id", nullable=false)
  141.      */
  142.     private $c_activity;
  143.     /**
  144.      * @ORM\Column(type="integer", nullable=true)
  145.      */
  146.     private $c_activity_id;
  147.     public function __construct()
  148.     {
  149.         $this->ad_user_roles = new ArrayCollection();
  150.         $this->ad_user_orgaccesses = new ArrayCollection();
  151.     }
  152.     public function getPasswordHasherName(): ?string
  153.     {
  154.         return 'idempiere';
  155.     }
  156.     public function getId(): int
  157.     {
  158.         return $this->getAdUserId();
  159.     }
  160.     public function getAdUserId(): ?int
  161.     {
  162.         return $this->ad_user_id;
  163.     }
  164.     public function setAdUserId(int $ad_user_id): self
  165.     {
  166.         $this->ad_user_id $ad_user_id;
  167.         return $this;
  168.     }
  169.     public function getAdUserUu(): ?string
  170.     {
  171.         return $this->ad_user_uu;
  172.     }
  173.     public function setAdUserUu(string $ad_user_uu): self
  174.     {
  175.         $this->ad_user_uu $ad_user_uu;
  176.         return $this;
  177.     }
  178.     public function getAdClientId(): ?int
  179.     {
  180.         return $this->ad_client_id;
  181.     }
  182.     public function setAdClientId(int $ad_client_id): self
  183.     {
  184.         $this->ad_client_id $ad_client_id;
  185.         return $this;
  186.     }
  187.     public function isActive(): ?bool
  188.     {
  189.         return $this->getIsactive() === "Y";
  190.     }
  191.     public function getIsactive(): ?string
  192.     {
  193.         return $this->isactive;
  194.     }
  195.     public function setIsactive(string $isactive): self
  196.     {
  197.         $this->isactive $isactive;
  198.         return $this;
  199.     }
  200.     public function setActive(bool $active): self
  201.     {
  202.         $this->setIsactive($active "Y" "N");
  203.         return $this;
  204.     }
  205.     public function getCreated(): ?\DateTimeInterface
  206.     {
  207.         return $this->created;
  208.     }
  209.     public function setCreated(\DateTimeInterface $created): self
  210.     {
  211.         $this->created $created;
  212.         return $this;
  213.     }
  214.     public function getCreatedby(): ?int
  215.     {
  216.         return $this->createdby;
  217.     }
  218.     public function setCreatedby(int $createdby): self
  219.     {
  220.         $this->createdby $createdby;
  221.         return $this;
  222.     }
  223.     public function getUpdated(): ?\DateTimeInterface
  224.     {
  225.         return $this->updated;
  226.     }
  227.     public function setUpdated(\DateTimeInterface $updated): self
  228.     {
  229.         $this->updated $updated;
  230.         return $this;
  231.     }
  232.     public function getUpdatedby(): ?int
  233.     {
  234.         return $this->updatedby;
  235.     }
  236.     public function setUpdatedby(int $updatedby): self
  237.     {
  238.         $this->updatedby $updatedby;
  239.         return $this;
  240.     }
  241.     public function getName(): ?string
  242.     {
  243.         return $this->name;
  244.     }
  245.     public function setName(string $name): self
  246.     {
  247.         $this->name $name;
  248.         return $this;
  249.     }
  250.     public function getUsername(): ?string
  251.     {
  252.         return $this->name;
  253.     }
  254.     /**
  255.      * The public representation of the user (e.g a username, an email)
  256.      * 
  257.      * @see UserInterface
  258.      */
  259.     public function getUserIdentifier(): String
  260.     {
  261.         return (string) $this->name;
  262.     }
  263.     public function getDescription(): ?string
  264.     {
  265.         return $this->description;
  266.     }
  267.     public function setDescription(string $description): self
  268.     {
  269.         $this->description $description;
  270.         return $this;
  271.     }
  272.     /**
  273.      * @see PasswordAuthenticatedUserInterface
  274.      */
  275.     public function getPassword(): ?string
  276.     {
  277.         return $this->password;
  278.     }
  279.     public function setPassword(string $password): self
  280.     {
  281.         $this->password $password;
  282.         return $this;
  283.     }
  284.     public function getEmail(): ?string
  285.     {
  286.         return $this->email;
  287.     }
  288.     public function setEmail(string $email): self
  289.     {
  290.         $this->email $email;
  291.         return $this;
  292.     }
  293.     public function getPhone(): ?string
  294.     {
  295.         return $this->phone;
  296.     }
  297.     public function setPhone(?string $phone): self
  298.     {
  299.         $this->phone $phone;
  300.         return $this;
  301.     }
  302.     public function getBirthday(): ?\DateTimeInterface
  303.     {
  304.         return $this->birthday;
  305.     }
  306.     public function setBirthday(?\DateTimeInterface $birthday): self
  307.     {
  308.         $this->birthday $birthday;
  309.         return $this;
  310.     }
  311.     /**
  312.      * Returning a salt is only needed, if you are not using a modern
  313.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  314.      *
  315.      * @see UserInterface
  316.      */
  317.     public function getSalt(): ?string
  318.     {
  319.         return $this->salt;
  320.     }
  321.     public function setSalt(string $salt): self
  322.     {
  323.         $this->salt $salt;
  324.         return $this;
  325.     }
  326.     public function getIslocked(): ?bool
  327.     {
  328.         return ($this->islocked === 'Y');
  329.     }
  330.     public function setIslocked(string $islocked): self
  331.     {
  332.         $this->islocked $islocked;
  333.         return $this;
  334.     }
  335.     public function getDateaccountlocked(): ?\DateTimeInterface
  336.     {
  337.         return $this->dateaccountlocked;
  338.     }
  339.     public function setDateaccountlocked(?\DateTimeInterface $dateaccountlocked): self
  340.     {
  341.         $this->dateaccountlocked $dateaccountlocked;
  342.         return $this;
  343.     }
  344.     public function getFailedlogincount(): ?int
  345.     {
  346.         return $this->failedlogincount;
  347.     }
  348.     public function setFailedlogincount(int $failedlogincount): self
  349.     {
  350.         $this->failedlogincount $failedlogincount;
  351.         return $this;
  352.     }
  353.     public function getDatepasswordchanged(): ?\DateTimeInterface
  354.     {
  355.         return $this->datepasswordchanged;
  356.     }
  357.     public function setDatepasswordchanged(?\DateTimeInterface $datepasswordchanged): self
  358.     {
  359.         $this->datepasswordchanged $datepasswordchanged;
  360.         return $this;
  361.     }
  362.     public function getDatelastlogin(): ?\DateTimeInterface
  363.     {
  364.         return $this->datelastlogin;
  365.     }
  366.     public function setDatelastlogin(?\DateTimeInterface $datelastlogin): self
  367.     {
  368.         $this->datelastlogin $datelastlogin;
  369.         return $this;
  370.     }
  371.     public function getIsexpired(): ?bool
  372.     {
  373.         return ($this->isexpired === 'Y');
  374.     }
  375.     public function setIsexpired(string $isexpired): self
  376.     {
  377.         $this->isexpired $isexpired;
  378.         return $this;
  379.     }
  380.     public function getSecurityquestion(): ?string
  381.     {
  382.         return $this->securityquestion;
  383.     }
  384.     public function setSecurityquestion(string $securityquestion): self
  385.     {
  386.         $this->securityquestion $securityquestion;
  387.         return $this;
  388.     }
  389.     public function getAnswer(): ?string
  390.     {
  391.         return $this->answer;
  392.     }
  393.     public function setAnswer(?string $answer): self
  394.     {
  395.         $this->answer $answer;
  396.         return $this;
  397.     }
  398.     public function getCBpartner(): ?CBpartner
  399.     {
  400.         return $this->c_bpartner;
  401.     }
  402.     public function setCBpartner(?CBpartner $c_bpartner): self
  403.     {
  404.         $this->c_bpartner $c_bpartner;
  405.         return $this;
  406.     }
  407.     public function getCBpartnerId(): ?int
  408.     {
  409.         return $this->c_bpartner_id;
  410.     }
  411.     public function setCBpartnerId(int $c_bpartner_id): self
  412.     {
  413.         $this->c_bpartner_id $c_bpartner_id;
  414.         return $this;
  415.     }
  416.     public function getCBpartnerLocation(): ?CBpartnerLocation
  417.     {
  418.         return $this->c_bpartner_location;
  419.     }
  420.     public function setCBpartnerLocation(?CBpartnerLocation $c_bpartner_location): self
  421.     {
  422.         $this->c_bpartner_location $c_bpartner_location;
  423.         return $this;
  424.     }
  425.     public function getCBpartnerLocationId(): ?int
  426.     {
  427.         return $this->c_bpartner_location_id;
  428.     }
  429.     public function setCBpartnerLocationId(?int $c_bpartner_location_id): self
  430.     {
  431.         $this->c_bpartner_location_id $c_bpartner_location_id;
  432.         return $this;
  433.     }
  434.     /**
  435.      * @return Collection<int, AdUserRoles>
  436.      */
  437.     public function getAdUserRoles(): Collection
  438.     {
  439.         return $this->ad_user_roles;
  440.     }
  441.     public function addAdUserRole(AdUserRoles $adUserRole): self
  442.     {
  443.         if (!$this->ad_user_roles->contains($adUserRole)) {
  444.             $this->ad_user_roles[] = $adUserRole;
  445.             $adUserRole->setAdUser($this);
  446.         }
  447.         return $this;
  448.     }
  449.     public function removeAdUserRole(AdUserRoles $adUserRole): self
  450.     {
  451.         if ($this->ad_user_roles->removeElement($adUserRole)) {
  452.             // set the owning side to null (unless already changed)
  453.             if ($adUserRole->getAdUser() === $this) {
  454.                 $adUserRole->setAdUser(null);
  455.             }
  456.         }
  457.         return $this;
  458.     }
  459.     /**
  460.      * @see UserInterface
  461.      */
  462.     public function getRoles(): Array
  463.     {
  464.         $roles = [];
  465.         $roles[] = 'ROLE_USER';
  466.         return array_unique($roles);
  467.     }
  468.     /**
  469.      * @see UserInterface
  470.      */
  471.     public function eraseCredentials()
  472.     {
  473.         // If you store any temporary, sensitive data on the user, clear it here
  474.         // $this->plainPassword = null;
  475.     }
  476.     /**
  477.      * @return Collection<int, AdUserOrgaccess>
  478.      */
  479.     public function getAdUserOrgaccesses(): Collection
  480.     {
  481.         return $this->ad_user_orgaccesses;
  482.     }
  483.     public function addAdUserOrgaccess(AdUserOrgaccess $adUserOrgaccess): self
  484.     {
  485.         if (!$this->ad_user_orgaccesses->contains($adUserOrgaccess)) {
  486.             $this->ad_user_orgaccesses[] = $adUserOrgaccess;
  487.             $adUserOrgaccess->setAdUser($this);
  488.         }
  489.         return $this;
  490.     }
  491.     public function removeAdUserOrgaccess(AdUserOrgaccess $adUserOrgaccess): self
  492.     {
  493.         if ($this->ad_user_orgaccesses->removeElement($adUserOrgaccess)) {
  494.             // set the owning side to null (unless already changed)
  495.             if ($adUserOrgaccess->getAdUser() === $this) {
  496.                 $adUserOrgaccess->setAdUser(null);
  497.             }
  498.         }
  499.         return $this;
  500.     }
  501.     public function getCActivity(): ?CActivity
  502.     {
  503.         return $this->c_activity;
  504.     }
  505.     public function setCActivity(?CActivity $c_activity): self
  506.     {
  507.         $this->c_activity $c_activity;
  508.         return $this;
  509.     }
  510.     public function getCActivityId(): ?int
  511.     {
  512.         return $this->c_activity_id;
  513.     }
  514.     public function setCActivityId(?int $c_activity_id): self
  515.     {
  516.         $this->c_activity_id $c_activity_id;
  517.         return $this;
  518.     }
  519. }