<commit_before><?php

/** @noinspection PhpMissingFieldTypeInspection */

namespace App\Entity;

use App\Annotations\AuditLog\Auditable;
use App\Validator\Constraints\UniqueEntity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

use const PASSWORD_ARGON2ID;

/**
 * @ORM\Table(name="sftp_user", uniqueConstraints={
 *     @ORM\UniqueConstraint(name="username_idx", columns={"username"})
 * })
 * @ORM\Entity()
 *
 * @UniqueEntity(fields={"username"})
 *
 * @Auditable()
 */
class SftpUser
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     *
     * @var int|null
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="Station", inversedBy="sftp_users")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="station_id", referencedColumnName="id", onDelete="CASCADE")
     * })
     * @var Station
     */
    protected $station;

    /**
     * @ORM\Column(name="username", type="string", length=32, nullable=false)
     * @var string
     *
     * @Assert\Length(min=1, max=32)
     * @Assert\NotBlank
     */
    protected $username;

    /**
     * @ORM\Column(name="password", type="string", length=255, nullable=false)
     * @var string
     *<commit_msg>#4153 -- Enforce regex rules for SFTP usernames.<commit_after><?php

/** @noinspection PhpMissingFieldTypeInspection */

namespace App\Entity;

use App\Annotations\AuditLog\Auditable;
use App\Validator\Constraints\UniqueEntity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

use const PASSWORD_ARGON2ID;

/**
 * @ORM\Table(name="sftp_user", uniqueConstraints={
 *     @ORM\UniqueConstraint(name="username_idx", columns={"username"})
 * })
 * @ORM\Entity()
 *
 * @UniqueEntity(fields={"username"})
 *
 * @Auditable()
 */
class SftpUser
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     *
     * @var int|null
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="Station", inversedBy="sftp_users")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="station_id", referencedColumnName="id", onDelete="CASCADE")
     * })
     * @var Station
     */
    protected $station;

    /**
     * @ORM\Column(name="username", type="string", length=32, nullable=false)
     * @var string
     *
     * @Assert\Length(min=1, max=32)
     * @Assert\NotBlank
     * @Assert\Regex(pattern="/^[a-zA-Z0-9-_.~]+$/")
     */
    protected $username;

    /**
     * @ORM\Column(name="password", type="string", length=255, nullable=false)
     * @var string
     *
{'fraction_non_alphanumeric': 0.1736370425690814, 'fraction_numerical': 0.008961911874533234, 'mean_word_length': 3.3490259740259742, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4976037', 'n_tokens_mistral': 931, 'n_tokens_neox': 899, 'n_words': 135}