mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 19:58:53 +02:00
Fixed code style.
This commit is contained in:
parent
1aed1d1d26
commit
9a7223a301
142 changed files with 534 additions and 716 deletions
|
@ -81,7 +81,7 @@ abstract class Attachment extends NamedDBElement
|
|||
protected $path = '';
|
||||
|
||||
/**
|
||||
* @var string The original filename the file had, when the user uploaded it.
|
||||
* @var string the original filename the file had, when the user uploaded it
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $original_filename;
|
||||
|
@ -138,8 +138,6 @@ abstract class Attachment extends NamedDBElement
|
|||
/**
|
||||
* Check if this attachment is a 3D model and therefore can be directly shown to user.
|
||||
* If the attachment is external, false is returned (3D Models must be internal).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is3DModel(): bool
|
||||
{
|
||||
|
@ -179,7 +177,7 @@ abstract class Attachment extends NamedDBElement
|
|||
* Check if this attachment is saved in a secure place.
|
||||
* This means that it can not be accessed directly via a web request, but must be viewed via a controller.
|
||||
*
|
||||
* @return bool True, if the file is secure.
|
||||
* @return bool true, if the file is secure
|
||||
*/
|
||||
public function isSecure(): bool
|
||||
{
|
||||
|
@ -197,7 +195,7 @@ abstract class Attachment extends NamedDBElement
|
|||
* Checks if the attachment file is using a builtin file. (see BUILTIN_PLACEHOLDERS const for possible placeholders)
|
||||
* If a file is built in, the path is shown to user in url field (no sensitive infos are provided).
|
||||
*
|
||||
* @return bool True if the attachment is using an builtin file.
|
||||
* @return bool true if the attachment is using an builtin file
|
||||
*/
|
||||
public function isBuiltIn(): bool
|
||||
{
|
||||
|
@ -215,7 +213,7 @@ abstract class Attachment extends NamedDBElement
|
|||
* For a path like %BASE/path/foo.bar, bar will be returned.
|
||||
* If this attachment is external null is returned.
|
||||
*
|
||||
* @return string|null The file extension in lower case.
|
||||
* @return string|null the file extension in lower case
|
||||
*/
|
||||
public function getExtension(): ?string
|
||||
{
|
||||
|
@ -233,7 +231,7 @@ abstract class Attachment extends NamedDBElement
|
|||
/**
|
||||
* Get the element, associated with this Attachment (for example a "Part" object).
|
||||
*
|
||||
* @return AttachmentContainingDBElement The associated Element.
|
||||
* @return AttachmentContainingDBElement the associated Element
|
||||
*/
|
||||
public function getElement(): ?AttachmentContainingDBElement
|
||||
{
|
||||
|
@ -243,8 +241,6 @@ abstract class Attachment extends NamedDBElement
|
|||
/**
|
||||
* The URL to the external file, or the path to the built in file.
|
||||
* Returns null, if the file is not external (and not builtin).
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getURL(): ?string
|
||||
{
|
||||
|
@ -258,8 +254,6 @@ abstract class Attachment extends NamedDBElement
|
|||
/**
|
||||
* Returns the hostname where the external file is stored.
|
||||
* Returns null, if the file is not external.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getHost(): ?string
|
||||
{
|
||||
|
@ -285,8 +279,6 @@ abstract class Attachment extends NamedDBElement
|
|||
* For a path like %BASE/path/foo.bar, foo.bar will be returned.
|
||||
*
|
||||
* If the path is a URL (can be checked via isExternal()), null will be returned.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFilename(): ?string
|
||||
{
|
||||
|
@ -356,10 +348,6 @@ abstract class Attachment extends NamedDBElement
|
|||
* Setters
|
||||
****************************************************************************************************/
|
||||
|
||||
/**
|
||||
* @param bool $show_in_table
|
||||
* @return self
|
||||
*/
|
||||
public function setShowInTable(bool $show_in_table): self
|
||||
{
|
||||
$this->show_in_table = $show_in_table;
|
||||
|
@ -369,7 +357,7 @@ abstract class Attachment extends NamedDBElement
|
|||
|
||||
/**
|
||||
* Sets the element that is associated with this attachment.
|
||||
* @param AttachmentContainingDBElement $element
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setElement(AttachmentContainingDBElement $element): self
|
||||
|
@ -384,8 +372,10 @@ abstract class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the filepath (with relative placeholder) for this attachment
|
||||
* @param string $path The new filepath of the attachment.
|
||||
* Sets the filepath (with relative placeholder) for this attachment.
|
||||
*
|
||||
* @param string $path the new filepath of the attachment
|
||||
*
|
||||
* @return Attachment
|
||||
*/
|
||||
public function setPath(string $path): self
|
||||
|
@ -396,7 +386,6 @@ abstract class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param AttachmentType $attachement_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttachmentType(AttachmentType $attachement_type): self
|
||||
|
@ -410,7 +399,6 @@ abstract class Attachment extends NamedDBElement
|
|||
* Sets the url associated with this attachment.
|
||||
* If the url is empty nothing is changed, to not override the file path.
|
||||
*
|
||||
* @param string|null $url
|
||||
* @return Attachment
|
||||
*/
|
||||
public function setURL(?string $url): self
|
||||
|
@ -438,7 +426,7 @@ abstract class Attachment extends NamedDBElement
|
|||
*
|
||||
* @param string $path The path that should be checked
|
||||
*
|
||||
* @return bool True if the path is pointing to a builtin resource.
|
||||
* @return bool true if the path is pointing to a builtin resource
|
||||
*/
|
||||
public static function checkIfBuiltin(string $path): bool
|
||||
{
|
||||
|
@ -455,7 +443,7 @@ abstract class Attachment extends NamedDBElement
|
|||
/**
|
||||
* Check if a string is a URL and is valid.
|
||||
*
|
||||
* @param $string string The string which should be checked.
|
||||
* @param $string string The string which should be checked
|
||||
* @param bool $path_required If true, the string must contain a path to be valid. (e.g. foo.bar would be invalid, foo.bar/test.php would be valid).
|
||||
* @param $only_http bool Set this to true, if only HTTPS or HTTP schemata should be allowed.
|
||||
* *Caution: When this is set to false, a attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
|
||||
|
|
|
@ -85,7 +85,6 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
|
|||
/**
|
||||
* Removes the given attachment from this element.
|
||||
*
|
||||
* @param Attachment $attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAttachment(Attachment $attachment): self
|
||||
|
|
|
@ -88,8 +88,6 @@ class AttachmentType extends StructuralDBElement
|
|||
* Gets an filter, which file types are allowed for attachment files.
|
||||
* Must be in the format of <input type=file> accept attribute
|
||||
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFiletypeFilter(): string
|
||||
{
|
||||
|
@ -98,7 +96,9 @@ class AttachmentType extends StructuralDBElement
|
|||
|
||||
/**
|
||||
* Sets the filetype filter pattern.
|
||||
*
|
||||
* @param string $filetype_filter The new filetype filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFiletypeFilter(string $filetype_filter): self
|
||||
|
|
|
@ -31,7 +31,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class AttachmentTypeAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var AttachmentType The element this attachment is associated with.
|
||||
* @var AttachmentType the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class CategoryAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Category The element this attachment is associated with.
|
||||
* @var Category the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class CurrencyAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Currency The element this attachment is associated with.
|
||||
* @var Currency the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class DeviceAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Device The element this attachment is associated with.
|
||||
* @var Device the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class FootprintAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Footprint The element this attachment is associated with.
|
||||
* @var Footprint the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class GroupAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Group The element this attachment is associated with.
|
||||
* @var Group the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class ManufacturerAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Manufacturer The element this attachment is associated with.
|
||||
* @var Manufacturer the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class MeasurementUnitAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Manufacturer The element this attachment is associated with.
|
||||
* @var Manufacturer the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class PartAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Part The element this attachment is associated with.
|
||||
* @var Part the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class StorelocationAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Storelocation The element this attachment is associated with.
|
||||
* @var Storelocation the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class SupplierAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var Supplier The element this attachment is associated with.
|
||||
* @var Supplier the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
class UserAttachment extends Attachment
|
||||
{
|
||||
/**
|
||||
* @var User The element this attachment is associated with.
|
||||
* @var User the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -173,8 +173,6 @@ abstract class Company extends PartsContainingDBElement
|
|||
* Set the addres.
|
||||
*
|
||||
* @param string $new_address the new address (with "\n" as line break)
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAddress(string $new_address): self
|
||||
{
|
||||
|
@ -187,8 +185,6 @@ abstract class Company extends PartsContainingDBElement
|
|||
* Set the phone number.
|
||||
*
|
||||
* @param string $new_phone_number the new phone number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPhoneNumber(string $new_phone_number): self
|
||||
{
|
||||
|
@ -201,8 +197,6 @@ abstract class Company extends PartsContainingDBElement
|
|||
* Set the fax number.
|
||||
*
|
||||
* @param string $new_fax_number the new fax number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFaxNumber(string $new_fax_number): self
|
||||
{
|
||||
|
@ -215,8 +209,6 @@ abstract class Company extends PartsContainingDBElement
|
|||
* Set the e-mail address.
|
||||
*
|
||||
* @param string $new_email_address the new e-mail address
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEmailAddress(string $new_email_address): self
|
||||
{
|
||||
|
@ -229,8 +221,6 @@ abstract class Company extends PartsContainingDBElement
|
|||
* Set the website.
|
||||
*
|
||||
* @param string $new_website the new website
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setWebsite(string $new_website): self
|
||||
{
|
||||
|
@ -243,8 +233,6 @@ abstract class Company extends PartsContainingDBElement
|
|||
* Set the link to the website of an article.
|
||||
*
|
||||
* @param string $new_url the new URL with the placeholder %PARTNUMBER% for the part number
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAutoProductUrl(string $new_url): self
|
||||
{
|
||||
|
|
|
@ -51,7 +51,6 @@ trait MasterAttachmentTrait
|
|||
/**
|
||||
* Sets the new master picture for this part.
|
||||
*
|
||||
* @param Attachment|null $new_master_attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function setMasterPictureAttachment(?Attachment $new_master_attachment)
|
||||
|
|
|
@ -29,14 +29,14 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
trait TimestampTrait
|
||||
{
|
||||
/**
|
||||
* @var \DateTime The date when this element was modified the last time.
|
||||
* @var \DateTime the date when this element was modified the last time
|
||||
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $lastModified;
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was created.
|
||||
* @var \DateTime the date when this element was created
|
||||
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
|
@ -46,7 +46,7 @@ trait TimestampTrait
|
|||
* Returns the last time when the element was modified.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return \DateTime|null The time of the last edit.
|
||||
* @return \DateTime|null the time of the last edit
|
||||
*/
|
||||
public function getLastModified(): ?\DateTime
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ trait TimestampTrait
|
|||
* Returns the date/time when the element was created.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return \DateTime|null The creation time of the part.
|
||||
* @return \DateTime|null the creation time of the part
|
||||
*/
|
||||
public function getAddedDate(): ?\DateTime
|
||||
{
|
||||
|
|
|
@ -133,7 +133,8 @@ class Device extends PartsContainingDBElement
|
|||
/**
|
||||
* Set the order quantity.
|
||||
*
|
||||
* @param int $new_order_quantity the new order quantity
|
||||
* @param int $new_order_quantity the new order quantity
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrderQuantity(int $new_order_quantity): self
|
||||
|
@ -150,6 +151,7 @@ class Device extends PartsContainingDBElement
|
|||
* Set the "order_only_missing_parts" attribute.
|
||||
*
|
||||
* @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute
|
||||
*
|
||||
* @return Device
|
||||
*/
|
||||
public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self
|
||||
|
|
|
@ -117,16 +117,12 @@ class Category extends PartsContainingDBElement
|
|||
return 'C'.sprintf('%09d', $this->getID());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPartnameHint(): string
|
||||
{
|
||||
return $this->partname_hint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $partname_hint
|
||||
* @return Category
|
||||
*/
|
||||
public function setPartnameHint(string $partname_hint): self
|
||||
|
@ -136,16 +132,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPartnameRegex(): string
|
||||
{
|
||||
return $this->partname_regex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $partname_regex
|
||||
* @return Category
|
||||
*/
|
||||
public function setPartnameRegex(string $partname_regex): self
|
||||
|
@ -155,16 +147,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisableFootprints(): bool
|
||||
{
|
||||
return $this->disable_footprints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_footprints
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableFootprints(bool $disable_footprints): self
|
||||
|
@ -174,16 +162,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisableManufacturers(): bool
|
||||
{
|
||||
return $this->disable_manufacturers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_manufacturers
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableManufacturers(bool $disable_manufacturers): self
|
||||
|
@ -193,16 +177,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisableAutodatasheets(): bool
|
||||
{
|
||||
return $this->disable_autodatasheets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_autodatasheets
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableAutodatasheets(bool $disable_autodatasheets): self
|
||||
|
@ -212,16 +192,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDisableProperties(): bool
|
||||
{
|
||||
return $this->disable_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_properties
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableProperties(bool $disable_properties): self
|
||||
|
@ -231,16 +207,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultDescription(): string
|
||||
{
|
||||
return $this->default_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $default_description
|
||||
* @return Category
|
||||
*/
|
||||
public function setDefaultDescription(string $default_description): self
|
||||
|
@ -250,16 +222,12 @@ class Category extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultComment(): string
|
||||
{
|
||||
return $this->default_comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $default_comment
|
||||
* @return Category
|
||||
*/
|
||||
public function setDefaultComment(string $default_comment): self
|
||||
|
|
|
@ -110,8 +110,6 @@ class Footprint extends PartsContainingDBElement
|
|||
|
||||
/**
|
||||
* Returns the 3D Model associated with this footprint.
|
||||
*
|
||||
* @return FootprintAttachment|null
|
||||
*/
|
||||
public function getFootprint3d(): ?FootprintAttachment
|
||||
{
|
||||
|
@ -128,6 +126,7 @@ class Footprint extends PartsContainingDBElement
|
|||
* Sets the 3D Model associated with this footprint.
|
||||
*
|
||||
* @param FootprintAttachment|null $new_attachment The new 3D Model
|
||||
*
|
||||
* @return Footprint
|
||||
*/
|
||||
public function setFootprint3d(?FootprintAttachment $new_attachment): self
|
||||
|
|
|
@ -113,16 +113,12 @@ class MeasurementUnit extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInteger(): bool
|
||||
{
|
||||
return $this->is_integer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $isInteger
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
public function setIsInteger(bool $isInteger): self
|
||||
|
@ -132,16 +128,12 @@ class MeasurementUnit extends PartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isUseSIPrefix(): bool
|
||||
{
|
||||
return $this->use_si_prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $usesSIPrefixes
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
public function setUseSIPrefix(bool $usesSIPrefixes): self
|
||||
|
|
|
@ -92,7 +92,7 @@ class Part extends AttachmentContainingDBElement
|
|||
protected $addedDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was modified the last time.
|
||||
* @var \DateTime the date when this element was modified the last time
|
||||
* @ColumnSecurity(type="datetime")
|
||||
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
|
||||
*/
|
||||
|
|
|
@ -112,6 +112,7 @@ class PartLot extends DBElement
|
|||
* This is the case, if the expiration date is greater the the current date.
|
||||
*
|
||||
* @return bool|null True, if the part lot is expired. Returns null, if no expiration date was set.
|
||||
*
|
||||
* @throws \Exception If an error with the DateTime occurs
|
||||
*/
|
||||
public function isExpired(): ?bool
|
||||
|
@ -137,7 +138,6 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Sets the description of the part lot.
|
||||
*
|
||||
* @param string $description
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setDescription(string $description): self
|
||||
|
@ -160,7 +160,6 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Sets the comment for this part lot.
|
||||
*
|
||||
* @param string $comment
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setComment(string $comment): self
|
||||
|
@ -207,7 +206,6 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Sets the storage location, where this part lot is stored.
|
||||
*
|
||||
* @param Storelocation|null $storage_location
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setStorageLocation(?Storelocation $storage_location): self
|
||||
|
@ -254,7 +252,6 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Set the unknown instock status of this part lot.
|
||||
*
|
||||
* @param bool $instock_unknown
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setInstockUnknown(bool $instock_unknown): self
|
||||
|
@ -292,7 +289,6 @@ class PartLot extends DBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $needs_refill
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setNeedsRefill(bool $needs_refill): self
|
||||
|
|
|
@ -37,14 +37,14 @@ trait AdvancedPropertyTrait
|
|||
protected $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string A comma separated list of tags, associated with the part.
|
||||
* @var string a comma separated list of tags, associated with the part
|
||||
* @ORM\Column(type="text")
|
||||
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
|
||||
*/
|
||||
protected $tags = '';
|
||||
|
||||
/**
|
||||
* @var float|null How much a single part unit weighs in grams.
|
||||
* @var float|null how much a single part unit weighs in grams
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @ColumnSecurity(type="float", placeholder=null)
|
||||
* @Assert\PositiveOrZero()
|
||||
|
@ -53,8 +53,6 @@ trait AdvancedPropertyTrait
|
|||
|
||||
/**
|
||||
* Checks if this part is marked, for that it needs further review.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isNeedsReview(): bool
|
||||
{
|
||||
|
@ -63,7 +61,9 @@ trait AdvancedPropertyTrait
|
|||
|
||||
/**
|
||||
* Sets the "needs review" status of this part.
|
||||
*
|
||||
* @param bool $needs_review The new status
|
||||
*
|
||||
* @return Part|self
|
||||
*/
|
||||
public function setNeedsReview(bool $needs_review): self
|
||||
|
@ -75,8 +75,6 @@ trait AdvancedPropertyTrait
|
|||
|
||||
/**
|
||||
* Gets a comma separated list, of tags, that are assigned to this part.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTags(): string
|
||||
{
|
||||
|
@ -87,7 +85,6 @@ trait AdvancedPropertyTrait
|
|||
* Sets a comma separated list of tags, that are assigned to this part.
|
||||
*
|
||||
* @param string $tags The new tags
|
||||
* @return self
|
||||
*/
|
||||
public function setTags(string $tags): self
|
||||
{
|
||||
|
@ -99,8 +96,6 @@ trait AdvancedPropertyTrait
|
|||
/**
|
||||
* Returns the mass of a single part unit.
|
||||
* Returns null, if the mass is unknown/not set yet.
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getMass(): ?float
|
||||
{
|
||||
|
@ -111,8 +106,7 @@ trait AdvancedPropertyTrait
|
|||
* Sets the mass of a single part unit.
|
||||
* Sett to null, if the mass is unknown.
|
||||
*
|
||||
* @param float|null $mass The new mass.
|
||||
* @return self
|
||||
* @param float|null $mass the new mass
|
||||
*/
|
||||
public function setMass(?float $mass): self
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ trait BasicPropertyTrait
|
|||
protected $visible = true;
|
||||
|
||||
/**
|
||||
* @var bool True, if the part is marked as favorite.
|
||||
* @var bool true, if the part is marked as favorite
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ColumnSecurity(type="boolean")
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ trait BasicPropertyTrait
|
|||
* Check if this part is a favorite.
|
||||
*
|
||||
* @return bool * true if this part is a favorite
|
||||
* * false if this part is not a favorite.
|
||||
* * false if this part is not a favorite
|
||||
*/
|
||||
public function isFavorite(): bool
|
||||
{
|
||||
|
@ -143,8 +143,6 @@ trait BasicPropertyTrait
|
|||
* Sets the description of this part.
|
||||
*
|
||||
* @param string $new_description the new description
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setDescription(?string $new_description): self
|
||||
{
|
||||
|
@ -157,8 +155,6 @@ trait BasicPropertyTrait
|
|||
* Sets the comment property of this part.
|
||||
*
|
||||
* @param string $new_comment the new comment
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setComment(string $new_comment): self
|
||||
{
|
||||
|
@ -172,8 +168,6 @@ trait BasicPropertyTrait
|
|||
* The category property is required for every part, so you can not pass null like the other properties (footprints).
|
||||
*
|
||||
* @param Category $category The new category of this part
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCategory(Category $category): self
|
||||
{
|
||||
|
@ -187,8 +181,6 @@ trait BasicPropertyTrait
|
|||
*
|
||||
* @param Footprint|null $new_footprint The new footprint of this part. Set to null, if this part should not have
|
||||
* a footprint.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFootprint(?Footprint $new_footprint): self
|
||||
{
|
||||
|
@ -202,8 +194,6 @@ trait BasicPropertyTrait
|
|||
*
|
||||
* @param $new_favorite_status bool The new favorite status, that should be applied on this part.
|
||||
* Set this to true, when the part should be a favorite.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFavorite(bool $new_favorite_status): self
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ trait InstockTrait
|
|||
protected $minamount = 0;
|
||||
|
||||
/**
|
||||
* @var ?MeasurementUnit The unit in which the part's amount is measured.
|
||||
* @var ?MeasurementUnit the unit in which the part's amount is measured
|
||||
* @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="parts")
|
||||
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
|
||||
* @ColumnSecurity(type="object", prefix="unit")
|
||||
|
@ -69,9 +69,6 @@ trait InstockTrait
|
|||
/**
|
||||
* Adds the given part lot, to the list of part lots.
|
||||
* The part lot is assigned to this part.
|
||||
*
|
||||
* @param PartLot $lot
|
||||
* @return self
|
||||
*/
|
||||
public function addPartLot(PartLot $lot): self
|
||||
{
|
||||
|
@ -84,9 +81,7 @@ trait InstockTrait
|
|||
/**
|
||||
* Removes the given part lot from the list of part lots.
|
||||
*
|
||||
* @param PartLot $lot The part lot that should be deleted.
|
||||
*
|
||||
* @return self
|
||||
* @param PartLot $lot the part lot that should be deleted
|
||||
*/
|
||||
public function removePartLot(PartLot $lot): self
|
||||
{
|
||||
|
@ -98,8 +93,6 @@ trait InstockTrait
|
|||
/**
|
||||
* Gets the measurement unit in which the part's amount should be measured.
|
||||
* Returns null if no specific unit was that. That means the parts are measured simply in quantity numbers.
|
||||
*
|
||||
* @return MeasurementUnit|null
|
||||
*/
|
||||
public function getPartUnit(): ?MeasurementUnit
|
||||
{
|
||||
|
@ -109,9 +102,6 @@ trait InstockTrait
|
|||
/**
|
||||
* Sets the measurement unit in which the part's amount should be measured.
|
||||
* Set to null, if the part should be measured in quantities.
|
||||
*
|
||||
* @param MeasurementUnit|null $partUnit
|
||||
* @return self
|
||||
*/
|
||||
public function setPartUnit(?MeasurementUnit $partUnit): self
|
||||
{
|
||||
|
@ -182,8 +172,6 @@ trait InstockTrait
|
|||
* See getPartUnit() for the associated unit.
|
||||
*
|
||||
* @param float $new_minamount the new count of parts which should be in stock at least
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMinAmount(float $new_minamount): self
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ trait ManufacturerTrait
|
|||
protected $manufacturer;
|
||||
|
||||
/**
|
||||
* @var string The url to the part on the manufacturer's homepage.
|
||||
* @var string the url to the part on the manufacturer's homepage
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
|
||||
|
@ -86,7 +86,7 @@ trait ManufacturerTrait
|
|||
/**
|
||||
* Similar to getManufacturerProductUrl, but here only the database value is returned.
|
||||
*
|
||||
* @return string The manufacturer url saved in DB for this part.
|
||||
* @return string the manufacturer url saved in DB for this part
|
||||
*/
|
||||
public function getCustomProductURL(): string
|
||||
{
|
||||
|
@ -115,7 +115,6 @@ trait ManufacturerTrait
|
|||
* Sets the manufacturing status for this part
|
||||
* See getManufacturingStatus() for valid values.
|
||||
*
|
||||
* @param string $manufacturing_status
|
||||
* @return Part
|
||||
*/
|
||||
public function setManufacturingStatus(string $manufacturing_status): self
|
||||
|
@ -137,8 +136,6 @@ trait ManufacturerTrait
|
|||
|
||||
/**
|
||||
* Returns the assigned manufacturer product number (MPN) for this part.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getManufacturerProductNumber(): string
|
||||
{
|
||||
|
@ -148,7 +145,6 @@ trait ManufacturerTrait
|
|||
/**
|
||||
* Sets the manufacturer product number (MPN) for this part.
|
||||
*
|
||||
* @param string $manufacturer_product_number
|
||||
* @return Part
|
||||
*/
|
||||
public function setManufacturerProductNumber(string $manufacturer_product_number): self
|
||||
|
@ -163,8 +159,6 @@ trait ManufacturerTrait
|
|||
* Set to "" if this part should use the automatically URL based on its manufacturer.
|
||||
*
|
||||
* @param string $new_url The new url
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setManufacturerProductURL(string $new_url): self
|
||||
{
|
||||
|
@ -178,8 +172,6 @@ trait ManufacturerTrait
|
|||
*
|
||||
* @param Manufacturer|null $new_manufacturer The new Manufacturer of this part. Set to null, if this part should
|
||||
* not have a manufacturer.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setManufacturer(?Manufacturer $new_manufacturer): self
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ use Doctrine\Common\Collections\Collection;
|
|||
trait OrderTrait
|
||||
{
|
||||
/**
|
||||
* @var Orderdetail[]|Collection The details about how and where you can order this part.
|
||||
* @var Orderdetail[]|Collection the details about how and where you can order this part
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ColumnSecurity(prefix="orderdetails", type="collection")
|
||||
|
@ -121,9 +121,7 @@ trait OrderTrait
|
|||
* Adds the given orderdetail to list of orderdetails.
|
||||
* The orderdetail is assigned to this part.
|
||||
*
|
||||
* @param Orderdetail $orderdetail The orderdetail that should be added.
|
||||
*
|
||||
* @return self
|
||||
* @param Orderdetail $orderdetail the orderdetail that should be added
|
||||
*/
|
||||
public function addOrderdetail(Orderdetail $orderdetail): self
|
||||
{
|
||||
|
@ -136,7 +134,6 @@ trait OrderTrait
|
|||
/**
|
||||
* Removes the given orderdetail from the list of orderdetails.
|
||||
*
|
||||
* @param Orderdetail $orderdetail
|
||||
* @return OrderTrait
|
||||
*/
|
||||
public function removeOrderdetail(Orderdetail $orderdetail): self
|
||||
|
@ -157,8 +154,6 @@ trait OrderTrait
|
|||
* (if the part has exactly one orderdetails,
|
||||
* set this orderdetails as order orderdetails.
|
||||
* Otherwise, set "no order orderdetails")
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): self
|
||||
{
|
||||
|
|
|
@ -145,7 +145,6 @@ class Storelocation extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $only_single_part
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setOnlySinglePart(bool $only_single_part): self
|
||||
|
@ -166,7 +165,6 @@ class Storelocation extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $limit_to_existing_parts
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setLimitToExistingParts(bool $limit_to_existing_parts): self
|
||||
|
@ -185,7 +183,6 @@ class Storelocation extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param MeasurementUnit|null $storage_type
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setStorageType(?MeasurementUnit $storage_type): self
|
||||
|
|
|
@ -127,7 +127,6 @@ class Supplier extends Company
|
|||
/**
|
||||
* Sets the default currency.
|
||||
*
|
||||
* @param Currency|null $default_currency
|
||||
* @return Supplier
|
||||
*/
|
||||
public function setDefaultCurrency(?Currency $default_currency): self
|
||||
|
@ -151,6 +150,7 @@ class Supplier extends Company
|
|||
* Sets the shipping costs for an order with this supplier.
|
||||
*
|
||||
* @param string|null $shipping_costs a bcmath string with the shipping costs
|
||||
*
|
||||
* @return Supplier
|
||||
*/
|
||||
public function setShippingCosts(?string $shipping_costs): self
|
||||
|
|
|
@ -46,7 +46,7 @@ class Currency extends StructuralDBElement
|
|||
protected $attachments;
|
||||
|
||||
/**
|
||||
* @var string The 3 letter ISO code of the currency.
|
||||
* @var string the 3 letter ISO code of the currency
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Currency()
|
||||
*/
|
||||
|
@ -95,8 +95,6 @@ class Currency extends StructuralDBElement
|
|||
|
||||
/**
|
||||
* Returns the inverse exchange rate (how many of the current currency the base unit is worth).
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getInverseExchangeRate(): ?string
|
||||
{
|
||||
|
@ -112,8 +110,6 @@ class Currency extends StructuralDBElement
|
|||
/**
|
||||
* Returns The exchange rate between this currency and the base currency
|
||||
* (how many base units the current currency is worth).
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getExchangeRate(): ?string
|
||||
{
|
||||
|
@ -122,8 +118,10 @@ class Currency extends StructuralDBElement
|
|||
|
||||
/**
|
||||
* Sets the exchange rate of the currency.
|
||||
*
|
||||
* @param string|null $exchange_rate The new exchange rate of the currency.
|
||||
* Set to null, if the exchange rate is unknown.
|
||||
* Set to null, if the exchange rate is unknown.
|
||||
*
|
||||
* @return Currency
|
||||
*/
|
||||
public function setExchangeRate(?string $exchange_rate): self
|
||||
|
|
|
@ -157,7 +157,7 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Get the supplier part-nr.
|
||||
*
|
||||
* @return string the part-nr.
|
||||
* @return string the part-nr
|
||||
*/
|
||||
public function getSupplierPartNr(): string
|
||||
{
|
||||
|
@ -228,7 +228,6 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Removes an pricedetail from this orderdetail.
|
||||
*
|
||||
* @param Pricedetail $pricedetail
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function removePricedetail(Pricedetail $pricedetail): self
|
||||
|
@ -276,7 +275,6 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Sets a new part with which this orderdetail is associated.
|
||||
*
|
||||
* @param Part $part
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function setPart(Part $part): self
|
||||
|
@ -289,7 +287,6 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Sets the new supplier associated with this orderdetail.
|
||||
*
|
||||
* @param Supplier $new_supplier
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function setSupplier(Supplier $new_supplier): self
|
||||
|
@ -333,7 +330,7 @@ class Orderdetail extends DBElement
|
|||
* Sets the custom product supplier URL for this order detail.
|
||||
* Set this to "", if the function getSupplierProductURL should return the automatic generated URL.
|
||||
*
|
||||
* @param $new_url string The new URL for the supplier URL.
|
||||
* @param $new_url string The new URL for the supplier URL
|
||||
*
|
||||
* @return Orderdetail
|
||||
*/
|
||||
|
|
|
@ -130,7 +130,7 @@ class Pricedetail extends DBElement
|
|||
/**
|
||||
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
|
||||
*
|
||||
* @return Orderdetail The orderdetail this price belongs to.
|
||||
* @return Orderdetail the orderdetail this price belongs to
|
||||
*/
|
||||
public function getOrderdetail(): Orderdetail
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ class Pricedetail extends DBElement
|
|||
* Returns the price associated with this pricedetail.
|
||||
* It is given in current currency and for the price related quantity.
|
||||
*
|
||||
* @return string The price as string, like returned raw from DB.
|
||||
* @return string the price as string, like returned raw from DB
|
||||
*/
|
||||
public function getPrice(): string
|
||||
{
|
||||
|
@ -215,8 +215,6 @@ class Pricedetail extends DBElement
|
|||
/**
|
||||
* Returns the currency associated with this price information.
|
||||
* Returns null, if no specific currency is selected and the global base currency should be assumed.
|
||||
*
|
||||
* @return Currency|null
|
||||
*/
|
||||
public function getCurrency(): ?Currency
|
||||
{
|
||||
|
@ -232,7 +230,6 @@ class Pricedetail extends DBElement
|
|||
/**
|
||||
* Sets the orderdetail to which this pricedetail belongs to.
|
||||
*
|
||||
* @param Orderdetail $orderdetail
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrderdetail(Orderdetail $orderdetail): self
|
||||
|
@ -246,7 +243,6 @@ class Pricedetail extends DBElement
|
|||
* Sets the currency associated with the price informations.
|
||||
* Set to null, to use the global base currency.
|
||||
*
|
||||
* @param Currency|null $currency
|
||||
* @return Pricedetail
|
||||
*/
|
||||
public function setCurrency(?Currency $currency): self
|
||||
|
@ -264,8 +260,6 @@ class Pricedetail extends DBElement
|
|||
* * This is the price for "price_related_quantity" parts!!
|
||||
* * Example: if "price_related_quantity" is '10',
|
||||
* you have to set here the price for 10 parts!
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPrice(string $new_price): self
|
||||
{
|
||||
|
@ -286,8 +280,6 @@ class Pricedetail extends DBElement
|
|||
* quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically.
|
||||
*
|
||||
* @param float $new_price_related_quantity the price related quantity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setPriceRelatedQuantity(float $new_price_related_quantity): self
|
||||
{
|
||||
|
@ -312,8 +304,6 @@ class Pricedetail extends DBElement
|
|||
* So the orderdetails would have three Pricedetails for one supplier.)
|
||||
*
|
||||
* @param float $new_min_discount_quantity the minimum discount quantity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setMinDiscountQuantity(float $new_min_discount_quantity): self
|
||||
{
|
||||
|
|
|
@ -78,6 +78,7 @@ class Group extends StructuralDBElement implements HasPermissionsInterface
|
|||
|
||||
/**
|
||||
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnforce2FA(): bool
|
||||
|
@ -87,17 +88,18 @@ class Group extends StructuralDBElement implements HasPermissionsInterface
|
|||
|
||||
/**
|
||||
* Sets if the user of this group are enforced to have two factor authentification enabled.
|
||||
*
|
||||
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEnforce2FA(bool $enforce2FA): Group
|
||||
public function setEnforce2FA(bool $enforce2FA): self
|
||||
{
|
||||
$this->enforce2FA = $enforce2FA;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface;
|
||||
|
@ -48,41 +47,46 @@ class U2FKey implements TwoFactorKeyInterface
|
|||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=64)
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
public $keyHandle;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
public $publicKey;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
public $certificate;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*
|
||||
* @var int
|
||||
**/
|
||||
public $counter;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="u2fKeys")
|
||||
*
|
||||
* @var User
|
||||
**/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
protected $name;
|
||||
|
||||
|
||||
public function fromRegistrationData(Registration $data): void
|
||||
{
|
||||
$this->keyHandle = $data->keyHandle;
|
||||
|
@ -91,62 +95,61 @@ class U2FKey implements TwoFactorKeyInterface
|
|||
$this->counter = $data->counter;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function getKeyHandle()
|
||||
{
|
||||
return $this->keyHandle;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function setKeyHandle($keyHandle)
|
||||
{
|
||||
$this->keyHandle = $keyHandle;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function getPublicKey()
|
||||
{
|
||||
return $this->publicKey;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function setPublicKey($publicKey)
|
||||
{
|
||||
$this->publicKey = $publicKey;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function getCertificate()
|
||||
{
|
||||
return $this->certificate;
|
||||
}
|
||||
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function setCertificate($certificate)
|
||||
{
|
||||
$this->certificate = $certificate;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function getCounter()
|
||||
{
|
||||
return $this->counter;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function setCounter($counter)
|
||||
{
|
||||
$this->counter = $counter;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
/** {@inheritdoc} */
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
@ -154,30 +157,33 @@ class U2FKey implements TwoFactorKeyInterface
|
|||
|
||||
/**
|
||||
* Gets the user, this U2F key belongs to.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUser() : User
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* The primary key ID of this key
|
||||
* The primary key ID of this key.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getID() : int
|
||||
public function getID(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user this U2F key belongs to.
|
||||
* @param TwoFactorInterface $new_user
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUser(TwoFactorInterface $new_user) : self
|
||||
public function setUser(TwoFactorInterface $new_user): self
|
||||
{
|
||||
$this->user = $new_user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ use App\Validator\Constraints\ValidPermission;
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorKeyInterface;
|
||||
use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
|
||||
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
||||
|
@ -70,7 +71,6 @@ use Scheb\TwoFactorBundle\Model\TrustedDeviceInterface;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
|
||||
|
||||
/**
|
||||
* This entity represents a user, which can log in and have permissions.
|
||||
|
@ -80,8 +80,7 @@ use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
|
|||
* @ORM\Table("`users`")
|
||||
* @UniqueEntity("name", message="validator.user.username_already_used")
|
||||
*/
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface,
|
||||
TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface
|
||||
{
|
||||
use MasterAttachmentTrait;
|
||||
|
||||
|
@ -205,8 +204,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected $trustedDeviceCookieVersion = 0;
|
||||
|
||||
/** @var Collection<TwoFactorKeyInterface>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $u2fKeys;
|
||||
|
||||
/**
|
||||
|
@ -319,7 +318,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Sets the password hash for this user.
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword(string $password): self
|
||||
|
@ -359,7 +357,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Sets the currency the users prefers to see prices in.
|
||||
*
|
||||
* @param Currency|null $currency
|
||||
* @return User
|
||||
*/
|
||||
public function setCurrency(?Currency $currency): self
|
||||
|
@ -422,7 +419,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Set the status, if the user needs a password change.
|
||||
*
|
||||
* @param bool $need_pw_change
|
||||
* @return User
|
||||
*/
|
||||
public function setNeedPwChange(bool $need_pw_change): self
|
||||
|
@ -433,7 +429,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the encrypted password reset token
|
||||
* Returns the encrypted password reset token.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPwResetToken(): ?string
|
||||
|
@ -442,18 +439,20 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the encrypted password reset token
|
||||
* @param string|null $pw_reset_token
|
||||
* Sets the encrypted password reset token.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function setPwResetToken(?string $pw_reset_token): User
|
||||
public function setPwResetToken(?string $pw_reset_token): self
|
||||
{
|
||||
$this->pw_reset_token = $pw_reset_token;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the datetime when the password reset token expires
|
||||
* Gets the datetime when the password reset token expires.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getPwResetExpires(): \DateTime
|
||||
|
@ -462,18 +461,17 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the datetime when the password reset token expires
|
||||
* @param \DateTime $pw_reset_expires
|
||||
* Sets the datetime when the password reset token expires.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function setPwResetExpires(\DateTime $pw_reset_expires): User
|
||||
public function setPwResetExpires(\DateTime $pw_reset_expires): self
|
||||
{
|
||||
$this->pw_reset_expires = $pw_reset_expires;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* Getters
|
||||
************************************************/
|
||||
|
@ -496,8 +494,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the username of this user
|
||||
* Change the username of this user.
|
||||
*
|
||||
* @param string $new_name The new username.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName(string $new_name): NamedDBElement
|
||||
|
@ -512,6 +512,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Get the first name of the user.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFirstName(): ?string
|
||||
|
@ -520,7 +521,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the first name of the user
|
||||
* Change the first name of the user.
|
||||
*
|
||||
* @param string $first_name The new first name
|
||||
*
|
||||
* @return $this
|
||||
|
@ -533,7 +535,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the last name of the user
|
||||
* Get the last name of the user.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastName(): ?string
|
||||
|
@ -542,7 +545,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the last name of the user
|
||||
* Change the last name of the user.
|
||||
*
|
||||
* @param string $last_name The new last name
|
||||
*
|
||||
* @return $this
|
||||
|
@ -555,7 +559,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the department of this user
|
||||
* Gets the department of this user.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDepartment(): ?string
|
||||
|
@ -564,8 +569,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the department of the user
|
||||
* Change the department of the user.
|
||||
*
|
||||
* @param string $department The new department
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function setDepartment(?string $department): self
|
||||
|
@ -577,6 +584,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Get the email of the user.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail(): ?string
|
||||
|
@ -585,8 +593,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Change the email of the user
|
||||
* Change the email of the user.
|
||||
*
|
||||
* @param string $email The new email adress
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmail(?string $email): self
|
||||
|
@ -598,8 +608,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Gets the language the user prefers (as 2 letter ISO code).
|
||||
*
|
||||
* @return string|null The 2 letter ISO code of the preferred language (e.g. 'en' or 'de').
|
||||
* If null is returned, the user has not specified a language and the server wide language should be used.
|
||||
* If null is returned, the user has not specified a language and the server wide language should be used.
|
||||
*/
|
||||
public function getLanguage(): ?string
|
||||
{
|
||||
|
@ -608,20 +619,24 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Change the language the user prefers.
|
||||
*
|
||||
* @param string|null $language The new language as 2 letter ISO code (e.g. 'en' or 'de').
|
||||
* Set to null, to use the system wide language.
|
||||
* Set to null, to use the system wide language.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function setLanguage(?string $language): self
|
||||
{
|
||||
$this->language = $language;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the timezone of the user
|
||||
* Gets the timezone of the user.
|
||||
*
|
||||
* @return string|null The timezone of the user (e.g. 'Europe/Berlin') or null if the user has not specified
|
||||
* a timezone (then the global one should be used)
|
||||
* a timezone (then the global one should be used)
|
||||
*/
|
||||
public function getTimezone(): ?string
|
||||
{
|
||||
|
@ -630,7 +645,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Change the timezone of this user.
|
||||
*
|
||||
* @param string $timezone|null The new timezone (e.g. 'Europe/Berlin') or null to use the system wide one.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimezone(?string $timezone): self
|
||||
|
@ -642,6 +659,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
|
||||
*
|
||||
* @return string|null The name of the theme the user wants to see, or null if the system wide should be used.
|
||||
*/
|
||||
public function getTheme(): ?string
|
||||
|
@ -651,8 +669,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Change the theme the user wants to see.
|
||||
*
|
||||
* @param string|null $theme The name of the theme (See See self::AVAILABLE_THEMES for valid values). Set to null
|
||||
* if the system wide theme should be used.
|
||||
* if the system wide theme should be used.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTheme(?string $theme): self
|
||||
|
@ -664,6 +684,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Gets the group to which this user belongs to.
|
||||
*
|
||||
* @return Group|null The group of this user. Null if this user does not have a group.
|
||||
*/
|
||||
public function getGroup(): ?Group
|
||||
|
@ -673,7 +694,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Sets the group of this user.
|
||||
*
|
||||
* @param Group|null $group The new group of this user. Set to null if this user should not have a group.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setGroup(?Group $group): self
|
||||
|
@ -685,12 +708,14 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Returns a string representation of this user (the full name).
|
||||
* E.g. 'Jane Doe (j.doe) [DISABLED]
|
||||
* E.g. 'Jane Doe (j.doe) [DISABLED].
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$tmp = $this->isDisabled() ? ' [DISABLED]' : '';
|
||||
|
||||
return $this->getFullName(true).$tmp;
|
||||
}
|
||||
|
||||
|
@ -706,6 +731,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Return the user name that should be shown in Google Authenticator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGoogleAuthenticatorUsername(): string
|
||||
|
@ -726,12 +752,13 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Sets the secret used for Google Authenticator. Set to null to disable Google Authenticator.
|
||||
* @param string|null $googleAuthenticatorSecret
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): self
|
||||
{
|
||||
$this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -739,11 +766,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* Check if the given code is a valid backup code.
|
||||
*
|
||||
* @param string $code The code that should be checked.
|
||||
*
|
||||
* @return bool True if the backup code is valid.
|
||||
*/
|
||||
public function isBackupCode(string $code): bool
|
||||
{
|
||||
return in_array($code, $this->backupCodes);
|
||||
return \in_array($code, $this->backupCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -754,48 +782,55 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
public function invalidateBackupCode(string $code): void
|
||||
{
|
||||
$key = array_search($code, $this->backupCodes);
|
||||
if ($key !== false){
|
||||
if (false !== $key) {
|
||||
unset($this->backupCodes[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of all valid backup codes
|
||||
* Returns the list of all valid backup codes.
|
||||
*
|
||||
* @return string[] An array with all backup codes
|
||||
*/
|
||||
public function getBackupCodes() : array
|
||||
public function getBackupCodes(): array
|
||||
{
|
||||
return $this->backupCodes ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the backup codes for this user. Existing backup codes are overridden.
|
||||
* @param string[] $codes An array containing the backup codes
|
||||
*
|
||||
* @param string[] $codes An array containing the backup codes
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws \Exception If an error with the datetime occurs
|
||||
*/
|
||||
public function setBackupCodes(array $codes) : self
|
||||
public function setBackupCodes(array $codes): self
|
||||
{
|
||||
$this->backupCodes = $codes;
|
||||
if(empty($codes)) {
|
||||
if (empty($codes)) {
|
||||
$this->backupCodesGenerationDate = null;
|
||||
} else {
|
||||
$this->backupCodesGenerationDate = new \DateTime();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the date when the backup codes were generated.
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getBackupCodesGenerationDate() : ?\DateTime
|
||||
public function getBackupCodesGenerationDate(): ?\DateTime
|
||||
{
|
||||
return $this->backupCodesGenerationDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return version for the trusted device token. Increase version to invalidate all trusted token of the user.
|
||||
*
|
||||
* @return int The version of trusted device token
|
||||
*/
|
||||
public function getTrustedTokenVersion(): int
|
||||
|
@ -807,22 +842,24 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* Invalidate all trusted device tokens at once, by incrementing the token version.
|
||||
* You have to flush the changes to database afterwards.
|
||||
*/
|
||||
public function invalidateTrustedDeviceTokens() : void
|
||||
public function invalidateTrustedDeviceTokens(): void
|
||||
{
|
||||
$this->trustedDeviceCookieVersion++;
|
||||
++$this->trustedDeviceCookieVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if U2F is enabled
|
||||
* Check if U2F is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isU2FAuthEnabled(): bool
|
||||
{
|
||||
return count($this->u2fKeys) > 0;
|
||||
return \count($this->u2fKeys) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all U2F Keys that are associated with this user
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
*
|
||||
* @return Collection<TwoFactorKeyInterface>
|
||||
*/
|
||||
public function getU2FKeys(): Collection
|
||||
|
@ -832,7 +869,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Add a U2F key to this user.
|
||||
* @param TwoFactorKeyInterface $key
|
||||
*/
|
||||
public function addU2FKey(TwoFactorKeyInterface $key): void
|
||||
{
|
||||
|
@ -841,7 +877,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Remove a U2F key from this user.
|
||||
* @param TwoFactorKeyInterface $key
|
||||
*/
|
||||
public function removeU2FKey(TwoFactorKeyInterface $key): void
|
||||
{
|
||||
|
@ -849,12 +884,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPreferredTwoFactorProvider(): ?string
|
||||
{
|
||||
//If U2F is available then prefer it
|
||||
if($this->isU2FAuthEnabled()) {
|
||||
if ($this->isU2FAuthEnabled()) {
|
||||
return 'u2f_two_factor';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue