mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-07 17:04:30 +02:00
Fixed some inspection issues
This commit is contained in:
parent
33475dca66
commit
42e604245c
85 changed files with 272 additions and 291 deletions
|
@ -45,12 +45,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
*/
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table('`groups`')]
|
||||
#[ORM\Index(name: 'group_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'group_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
#[NoLockout()]
|
||||
#[ORM\Index(columns: ['name'], name: 'group_idx_name')]
|
||||
#[ORM\Index(columns: ['parent_id', 'name'], name: 'group_idx_parent_name')]
|
||||
#[NoLockout]
|
||||
class Group extends AbstractStructuralDBElement implements HasPermissionsInterface
|
||||
{
|
||||
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
|
||||
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $children;
|
||||
|
||||
|
@ -61,21 +61,21 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
/**
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: User::class, mappedBy: 'group')]
|
||||
#[ORM\OneToMany(mappedBy: 'group', targetEntity: User::class)]
|
||||
protected Collection $users;
|
||||
|
||||
/**
|
||||
* @var bool If true all users associated with this group must have enabled some kind of two-factor authentication
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: Types::BOOLEAN, name: 'enforce_2fa')]
|
||||
#[ORM\Column(name: 'enforce_2fa', type: Types::BOOLEAN)]
|
||||
protected bool $enforce2FA = false;
|
||||
|
||||
/**
|
||||
* @var Collection<int, GroupAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'element', targetEntity: GroupAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
|
@ -85,14 +85,14 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Embedded(class: PermissionData::class, columnPrefix: 'permissions_')]
|
||||
#[ValidPermission()]
|
||||
#[ValidPermission]
|
||||
protected ?PermissionData $permissions = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, GroupParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'element', targetEntity: GroupParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ final class PermissionData implements \JsonSerializable
|
|||
* operation => value,
|
||||
* ]
|
||||
*/
|
||||
#[ORM\Column(type: Types::JSON, name: 'data')]
|
||||
#[ORM\Column(name: 'data', type: Types::JSON)]
|
||||
protected array $data = []
|
||||
)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use ApiPlatform\Doctrine\Common\Filter\DateFilterInterface;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
|
||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
||||
|
@ -80,7 +81,7 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
|
||||
#[ORM\Table('`users`')]
|
||||
#[ORM\Index(name: 'user_idx_username', columns: ['name'])]
|
||||
#[ORM\Index(columns: ['name'], name: 'user_idx_username')]
|
||||
#[ORM\AttributeOverrides([
|
||||
new ORM\AttributeOverride(name: 'name', column: new ORM\Column(type: Types::STRING, length: 180, unique: true))
|
||||
])]
|
||||
|
@ -100,9 +101,9 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
)]
|
||||
#[ApiFilter(PropertyFilter::class)]
|
||||
#[ApiFilter(LikeFilter::class, properties: ["name", "aboutMe"])]
|
||||
#[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)]
|
||||
#[ApiFilter(DateFilter::class, strategy: DateFilterInterface::EXCLUDE_NULL)]
|
||||
#[ApiFilter(OrderFilter::class, properties: ['name', 'id', 'addedDate', 'lastModified'])]
|
||||
#[NoLockout()]
|
||||
#[NoLockout]
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface,
|
||||
BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface
|
||||
{
|
||||
|
@ -133,8 +134,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @var string|null The theme
|
||||
*/
|
||||
#[Groups(['full', 'import', 'user:read'])]
|
||||
#[ORM\Column(type: Types::STRING, name: 'config_theme', nullable: true)]
|
||||
#[ValidTheme()]
|
||||
#[ORM\Column(name: 'config_theme', type: Types::STRING, nullable: true)]
|
||||
#[ValidTheme]
|
||||
protected ?string $theme = null;
|
||||
|
||||
/**
|
||||
|
@ -143,10 +144,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
#[ORM\Column(type: Types::STRING, nullable: true)]
|
||||
protected ?string $pw_reset_token = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_a')]
|
||||
#[ORM\Column(name: 'config_instock_comment_a', type: Types::TEXT)]
|
||||
protected string $instock_comment_a = '';
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_w')]
|
||||
#[ORM\Column(name: 'config_instock_comment_w', type: Types::TEXT)]
|
||||
protected string $instock_comment_w = '';
|
||||
|
||||
/**
|
||||
|
@ -189,7 +190,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
#[Assert\Timezone]
|
||||
#[Groups(['full', 'import', 'user:read'])]
|
||||
#[ORM\Column(type: Types::STRING, name: 'config_timezone', nullable: true)]
|
||||
#[ORM\Column(name: 'config_timezone', type: Types::STRING, nullable: true)]
|
||||
protected ?string $timezone = '';
|
||||
|
||||
/**
|
||||
|
@ -197,7 +198,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
#[Assert\Language]
|
||||
#[Groups(['full', 'import', 'user:read'])]
|
||||
#[ORM\Column(type: Types::STRING, name: 'config_language', nullable: true)]
|
||||
#[ORM\Column(name: 'config_language', type: Types::STRING, nullable: true)]
|
||||
protected ?string $language = '';
|
||||
|
||||
/**
|
||||
|
@ -310,7 +311,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Embedded(class: 'PermissionData', columnPrefix: 'permissions_')]
|
||||
#[ValidPermission()]
|
||||
#[ValidPermission]
|
||||
protected ?PermissionData $permissions = null;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue