mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed code style.
This commit is contained in:
parent
1aed1d1d26
commit
9a7223a301
142 changed files with 534 additions and 716 deletions
File diff suppressed because one or more lines are too long
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on the .php_cs.dist of the symfony project
|
* Based on the .php_cs.dist of the symfony project
|
||||||
* https://github.com/symfony/symfony/blob/4.4/.php_cs.dist
|
* https://github.com/symfony/symfony/blob/4.4/.php_cs.dist.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!file_exists(__DIR__.'/src')) {
|
if (!file_exists(__DIR__.'/src')) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,6 @@ class ConvertBBCodeCommand extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list which entities and which properties need to be checked.
|
* Returns a list which entities and which properties need to be checked.
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
protected function getTargetsLists(): array
|
protected function getTargetsLists(): array
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,6 @@ class AttachmentFileController extends AbstractController
|
||||||
* @Route("/attachment/{id}/download", name="attachment_download")
|
* @Route("/attachment/{id}/download", name="attachment_download")
|
||||||
*
|
*
|
||||||
* @return BinaryFileResponse
|
* @return BinaryFileResponse
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function download(Attachment $attachment, AttachmentManager $helper)
|
public function download(Attachment $attachment, AttachmentManager $helper)
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,7 +151,7 @@ class PartController extends AbstractController
|
||||||
$cid = $request->get('cid', 1);
|
$cid = $request->get('cid', 1);
|
||||||
|
|
||||||
$category = $em->find(Category::class, $cid);
|
$category = $em->find(Category::class, $cid);
|
||||||
if($category !== null) {
|
if (null !== $category) {
|
||||||
$new_part->setCategory($category);
|
$new_part->setCategory($category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class SecurityController extends AbstractController
|
||||||
$builder = $this->createFormBuilder();
|
$builder = $this->createFormBuilder();
|
||||||
$builder->add('user', TextType::class, [
|
$builder->add('user', TextType::class, [
|
||||||
'label' => $this->translator->trans('pw_reset.user_or_email'),
|
'label' => $this->translator->trans('pw_reset.user_or_email'),
|
||||||
'constraints' => [new NotBlank()]
|
'constraints' => [new NotBlank()],
|
||||||
]);
|
]);
|
||||||
$builder->add('captcha', CaptchaType::class, [
|
$builder->add('captcha', CaptchaType::class, [
|
||||||
'width' => 200,
|
'width' => 200,
|
||||||
|
@ -88,7 +88,7 @@ class SecurityController extends AbstractController
|
||||||
'length' => 6,
|
'length' => 6,
|
||||||
]);
|
]);
|
||||||
$builder->add('submit', SubmitType::class, [
|
$builder->add('submit', SubmitType::class, [
|
||||||
'label' => 'pw_reset.submit'
|
'label' => 'pw_reset.submit',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = $builder->getForm();
|
$form = $builder->getForm();
|
||||||
|
@ -97,11 +97,12 @@ class SecurityController extends AbstractController
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$passwordReset->request($form->getData()['user']);
|
$passwordReset->request($form->getData()['user']);
|
||||||
$this->addFlash('success', 'pw_reset.request.success');
|
$this->addFlash('success', 'pw_reset.request.success');
|
||||||
|
|
||||||
return $this->redirectToRoute('login');
|
return $this->redirectToRoute('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('security/pw_reset_request.html.twig', [
|
return $this->render('security/pw_reset_request.html.twig', [
|
||||||
'form' => $form->createView()
|
'form' => $form->createView(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,10 +122,10 @@ class SecurityController extends AbstractController
|
||||||
$data = ['username' => $user, 'token' => $token];
|
$data = ['username' => $user, 'token' => $token];
|
||||||
$builder = $this->createFormBuilder($data);
|
$builder = $this->createFormBuilder($data);
|
||||||
$builder->add('username', TextType::class, [
|
$builder->add('username', TextType::class, [
|
||||||
'label' => $this->translator->trans('pw_reset.username')
|
'label' => $this->translator->trans('pw_reset.username'),
|
||||||
]);
|
]);
|
||||||
$builder->add('token', TextType::class, [
|
$builder->add('token', TextType::class, [
|
||||||
'label' => $this->translator->trans('pw_reset.token')
|
'label' => $this->translator->trans('pw_reset.token'),
|
||||||
]);
|
]);
|
||||||
$builder->add('new_password', RepeatedType::class, [
|
$builder->add('new_password', RepeatedType::class, [
|
||||||
'type' => PasswordType::class,
|
'type' => PasswordType::class,
|
||||||
|
@ -138,7 +139,7 @@ class SecurityController extends AbstractController
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('submit', SubmitType::class, [
|
$builder->add('submit', SubmitType::class, [
|
||||||
'label' => 'pw_reset.submit'
|
'label' => 'pw_reset.submit',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = $builder->getForm();
|
$form = $builder->getForm();
|
||||||
|
@ -152,13 +153,13 @@ class SecurityController extends AbstractController
|
||||||
$this->addFlash('error', 'pw_reset.new_pw.error');
|
$this->addFlash('error', 'pw_reset.new_pw.error');
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('success', 'pw_reset.new_pw.success');
|
$this->addFlash('success', 'pw_reset.new_pw.success');
|
||||||
|
|
||||||
return $this->redirectToRoute('login');
|
return $this->redirectToRoute('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->render('security/pw_reset_new_pw.html.twig', [
|
return $this->render('security/pw_reset_new_pw.html.twig', [
|
||||||
'form' => $form->createView()
|
'form' => $form->createView(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller has the purpose to provide the data for all treeviews.
|
* This controller has the purpose to provide the data for all treeviews.
|
||||||
|
*
|
||||||
* @Route("/tree")
|
* @Route("/tree")
|
||||||
*/
|
*/
|
||||||
class TreeController extends AbstractController
|
class TreeController extends AbstractController
|
||||||
|
@ -52,6 +53,7 @@ class TreeController extends AbstractController
|
||||||
public function tools(ToolsTreeBuilder $builder)
|
public function tools(ToolsTreeBuilder $builder)
|
||||||
{
|
{
|
||||||
$tree = $builder->getTree();
|
$tree = $builder->getTree();
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@ class TreeController extends AbstractController
|
||||||
public function categoryTree(Category $category = null)
|
public function categoryTree(Category $category = null)
|
||||||
{
|
{
|
||||||
$tree = $this->treeGenerator->getTreeView(Category::class, $category);
|
$tree = $this->treeGenerator->getTreeView(Category::class, $category);
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +75,7 @@ class TreeController extends AbstractController
|
||||||
public function footprintTree(Footprint $footprint = null)
|
public function footprintTree(Footprint $footprint = null)
|
||||||
{
|
{
|
||||||
$tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint);
|
$tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint);
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +86,7 @@ class TreeController extends AbstractController
|
||||||
public function locationTree(Storelocation $location = null)
|
public function locationTree(Storelocation $location = null)
|
||||||
{
|
{
|
||||||
$tree = $this->treeGenerator->getTreeView(Storelocation::class, $location);
|
$tree = $this->treeGenerator->getTreeView(Storelocation::class, $location);
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +97,7 @@ class TreeController extends AbstractController
|
||||||
public function manufacturerTree(Manufacturer $manufacturer = null)
|
public function manufacturerTree(Manufacturer $manufacturer = null)
|
||||||
{
|
{
|
||||||
$tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer);
|
$tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer);
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +108,7 @@ class TreeController extends AbstractController
|
||||||
public function supplierTree(Supplier $supplier = null)
|
public function supplierTree(Supplier $supplier = null)
|
||||||
{
|
{
|
||||||
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier);
|
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier);
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +119,7 @@ class TreeController extends AbstractController
|
||||||
public function deviceTree(Device $device = null)
|
public function deviceTree(Device $device = null)
|
||||||
{
|
{
|
||||||
$tree = $this->treeGenerator->getTreeView(Device::class, $device, '');
|
$tree = $this->treeGenerator->getTreeView(Device::class, $device, '');
|
||||||
|
|
||||||
return new JsonResponse($tree);
|
return new JsonResponse($tree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
{
|
{
|
||||||
//Handle 2FA disabling
|
//Handle 2FA disabling
|
||||||
|
|
||||||
if($request->request->has('reset_2fa')) {
|
if ($request->request->has('reset_2fa')) {
|
||||||
//Check if the admin has the needed permissions
|
//Check if the admin has the needed permissions
|
||||||
$this->denyAccessUnlessGranted('set_password', $entity);
|
$this->denyAccessUnlessGranted('set_password', $entity);
|
||||||
if ($this->isCsrfTokenValid('reset_2fa'.$entity->getId(), $request->request->get('_token'))) {
|
if ($this->isCsrfTokenValid('reset_2fa'.$entity->getId(), $request->request->get('_token'))) {
|
||||||
|
@ -64,7 +64,7 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
$entity->setGoogleAuthenticatorSecret(null);
|
$entity->setGoogleAuthenticatorSecret(null);
|
||||||
$entity->setBackupCodes([]);
|
$entity->setBackupCodes([]);
|
||||||
//Remove all U2F keys
|
//Remove all U2F keys
|
||||||
foreach($entity->getU2FKeys() as $key) {
|
foreach ($entity->getU2FKeys() as $key) {
|
||||||
$em->remove($key);
|
$em->remove($key);
|
||||||
}
|
}
|
||||||
//Invalidate trusted devices
|
//Invalidate trusted devices
|
||||||
|
@ -136,7 +136,6 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
//If no user id was passed, then we show info about the current user
|
//If no user id was passed, then we show info about the current user
|
||||||
if (null === $user) {
|
if (null === $user) {
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//Else we must check, if the current user is allowed to access $user
|
//Else we must check, if the current user is allowed to access $user
|
||||||
$this->denyAccessUnlessGranted('read', $user);
|
$this->denyAccessUnlessGranted('read', $user);
|
||||||
|
|
|
@ -21,14 +21,12 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\UserSystem\U2FKey;
|
use App\Entity\UserSystem\U2FKey;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Form\TFAGoogleSettingsType;
|
use App\Form\TFAGoogleSettingsType;
|
||||||
use App\Form\UserSettingsType;
|
use App\Form\UserSettingsType;
|
||||||
use App\Services\TFA\BackupCodeManager;
|
use App\Services\TFA\BackupCodeManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Exception;
|
|
||||||
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticator;
|
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticator;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||||
|
@ -43,7 +41,6 @@ use Symfony\Component\Validator\Constraints\Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/user")
|
* @Route("/user")
|
||||||
* @package App\Controller
|
|
||||||
*/
|
*/
|
||||||
class UserSettingsController extends AbstractController
|
class UserSettingsController extends AbstractController
|
||||||
{
|
{
|
||||||
|
@ -74,7 +71,7 @@ class UserSettingsController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('Users/backup_codes.html.twig', [
|
return $this->render('Users/backup_codes.html.twig', [
|
||||||
'user' => $user
|
'user' => $user,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +82,7 @@ class UserSettingsController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager)
|
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager)
|
||||||
{
|
{
|
||||||
if($this->demo_mode) {
|
if ($this->demo_mode) {
|
||||||
throw new \RuntimeException('You can not do 2FA things in demo mode');
|
throw new \RuntimeException('You can not do 2FA things in demo mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,15 +95,14 @@ class UserSettingsController extends AbstractController
|
||||||
throw new \RuntimeException('This controller only works only for Part-DB User objects!');
|
throw new \RuntimeException('This controller only works only for Part-DB User objects!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->request->get('_token'))) {
|
if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->request->get('_token'))) {
|
||||||
if($request->request->has('key_id')) {
|
if ($request->request->has('key_id')) {
|
||||||
$key_id = $request->request->get('key_id');
|
$key_id = $request->request->get('key_id');
|
||||||
$key_repo = $entityManager->getRepository(U2FKey::class);
|
$key_repo = $entityManager->getRepository(U2FKey::class);
|
||||||
/** @var U2FKey|null $u2f */
|
/** @var U2FKey|null $u2f */
|
||||||
$u2f = $key_repo->find($key_id);
|
$u2f = $key_repo->find($key_id);
|
||||||
if($u2f === null) {
|
if (null === $u2f) {
|
||||||
$this->addFlash('danger','tfa_u2f.u2f_delete.not_existing');
|
$this->addFlash('danger', 'tfa_u2f.u2f_delete.not_existing');
|
||||||
throw new \RuntimeException('Key not existing!');
|
throw new \RuntimeException('Key not existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +118,7 @@ class UserSettingsController extends AbstractController
|
||||||
$this->addFlash('success', 'tfa.u2f.u2f_delete.success');
|
$this->addFlash('success', 'tfa.u2f.u2f_delete.success');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('error','csfr_invalid');
|
$this->addFlash('error', 'csfr_invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('user_settings');
|
return $this->redirectToRoute('user_settings');
|
||||||
|
@ -133,7 +129,7 @@ class UserSettingsController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager)
|
public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
if($this->demo_mode) {
|
if ($this->demo_mode) {
|
||||||
throw new \RuntimeException('You can not do 2FA things in demo mode');
|
throw new \RuntimeException('You can not do 2FA things in demo mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,13 +142,12 @@ class UserSettingsController extends AbstractController
|
||||||
return new \RuntimeException('This controller only works only for Part-DB User objects!');
|
return new \RuntimeException('This controller only works only for Part-DB User objects!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->isCsrfTokenValid('devices_reset'.$user->getId(), $request->request->get('_token'))) {
|
if ($this->isCsrfTokenValid('devices_reset'.$user->getId(), $request->request->get('_token'))) {
|
||||||
$user->invalidateTrustedDeviceTokens();
|
$user->invalidateTrustedDeviceTokens();
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$this->addFlash('success', 'tfa_trustedDevice.invalidate.success');
|
$this->addFlash('success', 'tfa_trustedDevice.invalidate.success');
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('error','csfr_invalid');
|
$this->addFlash('error', 'csfr_invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('user_settings');
|
return $this->redirectToRoute('user_settings');
|
||||||
|
@ -205,7 +200,7 @@ class UserSettingsController extends AbstractController
|
||||||
'data' => $user->getName(),
|
'data' => $user->getName(),
|
||||||
'attr' => ['autocomplete' => 'username'],
|
'attr' => ['autocomplete' => 'username'],
|
||||||
'disabled' => true,
|
'disabled' => true,
|
||||||
'row_attr' => ['class' => 'd-none']
|
'row_attr' => ['class' => 'd-none'],
|
||||||
])
|
])
|
||||||
->add('old_password', PasswordType::class, [
|
->add('old_password', PasswordType::class, [
|
||||||
'label' => 'user.settings.pw_old.label',
|
'label' => 'user.settings.pw_old.label',
|
||||||
|
@ -219,7 +214,7 @@ class UserSettingsController extends AbstractController
|
||||||
'second_options' => ['label' => 'user.settings.pw_confirm.label'],
|
'second_options' => ['label' => 'user.settings.pw_confirm.label'],
|
||||||
'invalid_message' => 'password_must_match',
|
'invalid_message' => 'password_must_match',
|
||||||
'options' => [
|
'options' => [
|
||||||
'attr' => ['autocomplete' => 'new-password']
|
'attr' => ['autocomplete' => 'new-password'],
|
||||||
],
|
],
|
||||||
'constraints' => [new Length([
|
'constraints' => [new Length([
|
||||||
'min' => 6,
|
'min' => 6,
|
||||||
|
@ -260,6 +255,7 @@ class UserSettingsController extends AbstractController
|
||||||
$backupCodeManager->enableBackupCodes($user);
|
$backupCodeManager->enableBackupCodes($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', 'user.settings.2fa.google.activated');
|
$this->addFlash('success', 'user.settings.2fa.google.activated');
|
||||||
|
|
||||||
return $this->redirectToRoute('user_settings');
|
return $this->redirectToRoute('user_settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,14 +265,15 @@ class UserSettingsController extends AbstractController
|
||||||
$backupCodeManager->disableBackupCodesIfUnused($user);
|
$backupCodeManager->disableBackupCodesIfUnused($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', 'user.settings.2fa.google.disabled');
|
$this->addFlash('success', 'user.settings.2fa.google.disabled');
|
||||||
|
|
||||||
return $this->redirectToRoute('user_settings');
|
return $this->redirectToRoute('user_settings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$backup_form = $this->get('form.factory')->createNamedBuilder('backup_codes')->add('reset_codes', SubmitType::class,[
|
$backup_form = $this->get('form.factory')->createNamedBuilder('backup_codes')->add('reset_codes', SubmitType::class, [
|
||||||
'label' => 'tfa_backup.regenerate_codes',
|
'label' => 'tfa_backup.regenerate_codes',
|
||||||
'attr' => ['class' => 'btn-danger'],
|
'attr' => ['class' => 'btn-danger'],
|
||||||
'disabled' => empty($user->getBackupCodes())
|
'disabled' => empty($user->getBackupCodes()),
|
||||||
])->getForm();
|
])->getForm();
|
||||||
|
|
||||||
$backup_form->handleRequest($request);
|
$backup_form->handleRequest($request);
|
||||||
|
@ -286,7 +283,6 @@ class UserSettingsController extends AbstractController
|
||||||
$this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated');
|
$this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************
|
/******************************
|
||||||
* Output both forms
|
* Output both forms
|
||||||
*****************************/
|
*****************************/
|
||||||
|
@ -303,8 +299,8 @@ class UserSettingsController extends AbstractController
|
||||||
'enabled' => $google_enabled,
|
'enabled' => $google_enabled,
|
||||||
'qrContent' => $googleAuthenticator->getQRContent($user),
|
'qrContent' => $googleAuthenticator->getQRContent($user),
|
||||||
'secret' => $user->getGoogleAuthenticatorSecret(),
|
'secret' => $user->getGoogleAuthenticatorSecret(),
|
||||||
'username' => $user->getGoogleAuthenticatorUsername()
|
'username' => $user->getGoogleAuthenticatorUsername(),
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\DataTables\Adapter;
|
namespace App\DataTables\Adapter;
|
||||||
|
|
||||||
|
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Omines\DataTablesBundle\Adapter\AdapterQuery;
|
use Omines\DataTablesBundle\Adapter\AdapterQuery;
|
||||||
|
@ -31,24 +30,25 @@ use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||||
/**
|
/**
|
||||||
* Override default ORM Adapter, to allow fetch joins (allow addSelect with ManyToOne Collections).
|
* Override default ORM Adapter, to allow fetch joins (allow addSelect with ManyToOne Collections).
|
||||||
* This should improves performance for Part Tables.
|
* This should improves performance for Part Tables.
|
||||||
* Based on: https://github.com/omines/datatables-bundle/blob/master/tests/Fixtures/AppBundle/DataTable/Adapter/CustomORMAdapter.php
|
* Based on: https://github.com/omines/datatables-bundle/blob/master/tests/Fixtures/AppBundle/DataTable/Adapter/CustomORMAdapter.php.
|
||||||
* @package App\DataTables\Adapter
|
|
||||||
*/
|
*/
|
||||||
class CustomORMAdapter extends ORMAdapter
|
class CustomORMAdapter extends ORMAdapter
|
||||||
{
|
{
|
||||||
protected $hydrationMode;
|
protected $hydrationMode;
|
||||||
|
|
||||||
public function configure(array $options)
|
public function configure(array $options)
|
||||||
{
|
{
|
||||||
parent::configure($options);
|
parent::configure($options);
|
||||||
$this->hydrationMode = isset($options['hydrate']) ? $options['hydrate'] : Query::HYDRATE_OBJECT;
|
$this->hydrationMode = isset($options['hydrate']) ? $options['hydrate'] : Query::HYDRATE_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function prepareQuery(AdapterQuery $query)
|
protected function prepareQuery(AdapterQuery $query)
|
||||||
{
|
{
|
||||||
parent::prepareQuery($query);
|
parent::prepareQuery($query);
|
||||||
$query->setIdentifierPropertyPath(null);
|
$query->setIdentifierPropertyPath(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AdapterQuery $query
|
|
||||||
* @return \Traversable
|
* @return \Traversable
|
||||||
*/
|
*/
|
||||||
protected function getResults(AdapterQuery $query): \Traversable
|
protected function getResults(AdapterQuery $query): \Traversable
|
||||||
|
@ -78,4 +78,4 @@ class CustomORMAdapter extends ORMAdapter
|
||||||
yield $result;
|
yield $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\DataTables\Column;
|
namespace App\DataTables\Column;
|
||||||
|
|
||||||
|
|
||||||
use App\Services\MarkdownParser;
|
use App\Services\MarkdownParser;
|
||||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||||
|
|
||||||
|
@ -38,10 +37,11 @@ class MarkdownColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
{
|
{
|
||||||
return $this->markdown->markForRendering($value, true);
|
return $this->markdown->markForRendering($value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,16 @@
|
||||||
|
|
||||||
namespace App\DataTables\Column;
|
namespace App\DataTables\Column;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Attachments\Attachment;
|
use App\Entity\Attachments\Attachment;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use App\Services\Attachments\AttachmentManager;
|
use App\Services\Attachments\AttachmentManager;
|
||||||
use App\Services\Attachments\AttachmentURLGenerator;
|
|
||||||
use App\Services\EntityURLGenerator;
|
use App\Services\EntityURLGenerator;
|
||||||
use App\Services\FAIconGenerator;
|
use App\Services\FAIconGenerator;
|
||||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
||||||
|
|
||||||
|
|
||||||
class PartAttachmentsColumn extends AbstractColumn
|
class PartAttachmentsColumn extends AbstractColumn
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $FAIconGenerator;
|
protected $FAIconGenerator;
|
||||||
protected $urlGenerator;
|
protected $urlGenerator;
|
||||||
protected $attachmentManager;
|
protected $attachmentManager;
|
||||||
|
@ -51,6 +46,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
|
@ -63,7 +59,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
if (!$context instanceof Part) {
|
if (!$context instanceof Part) {
|
||||||
throw new \RuntimeException('$context must be a Part object!');
|
throw new \RuntimeException('$context must be a Part object!');
|
||||||
}
|
}
|
||||||
$tmp = "";
|
$tmp = '';
|
||||||
$attachments = $context->getAttachments()->filter(function (Attachment $attachment) {
|
$attachments = $context->getAttachments()->filter(function (Attachment $attachment) {
|
||||||
return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment);
|
return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment);
|
||||||
});
|
});
|
||||||
|
@ -74,11 +70,11 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
if (--$count < 0) {
|
if (--$count < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/** @var Attachment $attachment */
|
/* @var Attachment $attachment */
|
||||||
$tmp .= sprintf(
|
$tmp .= sprintf(
|
||||||
'<a href="%s" title="%s" class="attach-table-icon" target="_blank" rel="noopener" data-no-ajax>%s</a>',
|
'<a href="%s" title="%s" class="attach-table-icon" target="_blank" rel="noopener" data-no-ajax>%s</a>',
|
||||||
$this->urlGenerator->viewURL($attachment),
|
$this->urlGenerator->viewURL($attachment),
|
||||||
htmlspecialchars($attachment->getName()) . ': ' . htmlspecialchars($attachment->getFilename()),
|
htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename()),
|
||||||
$this->FAIconGenerator->generateIconHTML(
|
$this->FAIconGenerator->generateIconHTML(
|
||||||
// Sometimes the extension can not be determined, so ensure a generic icon is shown
|
// Sometimes the extension can not be determined, so ensure a generic icon is shown
|
||||||
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),
|
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),
|
||||||
|
@ -95,4 +91,4 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
{
|
{
|
||||||
parent::configureOptions($resolver);
|
parent::configureOptions($resolver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,11 @@
|
||||||
|
|
||||||
namespace App\DataTables\Column;
|
namespace App\DataTables\Column;
|
||||||
|
|
||||||
|
|
||||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
class TagsColumn extends AbstractColumn
|
class TagsColumn extends AbstractColumn
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $urlGenerator;
|
protected $urlGenerator;
|
||||||
|
|
||||||
public function __construct(UrlGeneratorInterface $urlGenerator)
|
public function __construct(UrlGeneratorInterface $urlGenerator)
|
||||||
|
@ -39,6 +37,7 @@ class TagsColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
|
@ -46,6 +45,7 @@ class TagsColumn extends AbstractColumn
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return explode(',', $value);
|
return explode(',', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,4 +67,4 @@ class TagsColumn extends AbstractColumn
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ use App\DataTables\Column\LocaleDateTimeColumn;
|
||||||
use App\DataTables\Column\MarkdownColumn;
|
use App\DataTables\Column\MarkdownColumn;
|
||||||
use App\DataTables\Column\PartAttachmentsColumn;
|
use App\DataTables\Column\PartAttachmentsColumn;
|
||||||
use App\DataTables\Column\TagsColumn;
|
use App\DataTables\Column\TagsColumn;
|
||||||
use App\Entity\Attachments\Attachment;
|
|
||||||
use App\Entity\Parts\Category;
|
use App\Entity\Parts\Category;
|
||||||
use App\Entity\Parts\Footprint;
|
use App\Entity\Parts\Footprint;
|
||||||
use App\Entity\Parts\Manufacturer;
|
use App\Entity\Parts\Manufacturer;
|
||||||
|
@ -38,19 +37,15 @@ use App\Services\AmountFormatter;
|
||||||
use App\Services\Attachments\AttachmentURLGenerator;
|
use App\Services\Attachments\AttachmentURLGenerator;
|
||||||
use App\Services\Attachments\PartPreviewGenerator;
|
use App\Services\Attachments\PartPreviewGenerator;
|
||||||
use App\Services\EntityURLGenerator;
|
use App\Services\EntityURLGenerator;
|
||||||
use App\Services\FAIconGenerator;
|
|
||||||
use App\Services\MarkdownParser;
|
|
||||||
use App\Services\Trees\NodesListBuilder;
|
use App\Services\Trees\NodesListBuilder;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORM\SearchCriteriaProvider;
|
use Omines\DataTablesBundle\Adapter\Doctrine\ORM\SearchCriteriaProvider;
|
||||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter;
|
|
||||||
use Omines\DataTablesBundle\Column\BoolColumn;
|
use Omines\DataTablesBundle\Column\BoolColumn;
|
||||||
use Omines\DataTablesBundle\Column\MapColumn;
|
use Omines\DataTablesBundle\Column\MapColumn;
|
||||||
use Omines\DataTablesBundle\Column\TextColumn;
|
use Omines\DataTablesBundle\Column\TextColumn;
|
||||||
use Omines\DataTablesBundle\DataTable;
|
use Omines\DataTablesBundle\DataTable;
|
||||||
use Omines\DataTablesBundle\DataTableTypeInterface;
|
use Omines\DataTablesBundle\DataTableTypeInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
use function foo\func;
|
|
||||||
|
|
||||||
class PartsDataTable implements DataTableTypeInterface
|
class PartsDataTable implements DataTableTypeInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,7 @@ abstract class Attachment extends NamedDBElement
|
||||||
protected $path = '';
|
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)
|
* @ORM\Column(type="string", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $original_filename;
|
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.
|
* 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).
|
* If the attachment is external, false is returned (3D Models must be internal).
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function is3DModel(): bool
|
public function is3DModel(): bool
|
||||||
{
|
{
|
||||||
|
@ -179,7 +177,7 @@ abstract class Attachment extends NamedDBElement
|
||||||
* Check if this attachment is saved in a secure place.
|
* 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.
|
* 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
|
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)
|
* 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).
|
* 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
|
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.
|
* For a path like %BASE/path/foo.bar, bar will be returned.
|
||||||
* If this attachment is external null is 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
|
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).
|
* 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
|
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.
|
* 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).
|
* Returns null, if the file is not external (and not builtin).
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getURL(): ?string
|
public function getURL(): ?string
|
||||||
{
|
{
|
||||||
|
@ -258,8 +254,6 @@ abstract class Attachment extends NamedDBElement
|
||||||
/**
|
/**
|
||||||
* Returns the hostname where the external file is stored.
|
* Returns the hostname where the external file is stored.
|
||||||
* Returns null, if the file is not external.
|
* Returns null, if the file is not external.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getHost(): ?string
|
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.
|
* 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.
|
* If the path is a URL (can be checked via isExternal()), null will be returned.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getFilename(): ?string
|
public function getFilename(): ?string
|
||||||
{
|
{
|
||||||
|
@ -356,10 +348,6 @@ abstract class Attachment extends NamedDBElement
|
||||||
* Setters
|
* Setters
|
||||||
****************************************************************************************************/
|
****************************************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bool $show_in_table
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setShowInTable(bool $show_in_table): self
|
public function setShowInTable(bool $show_in_table): self
|
||||||
{
|
{
|
||||||
$this->show_in_table = $show_in_table;
|
$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.
|
* Sets the element that is associated with this attachment.
|
||||||
* @param AttachmentContainingDBElement $element
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setElement(AttachmentContainingDBElement $element): self
|
public function setElement(AttachmentContainingDBElement $element): self
|
||||||
|
@ -384,8 +372,10 @@ abstract class Attachment extends NamedDBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the filepath (with relative placeholder) for this attachment
|
* Sets the filepath (with relative placeholder) for this attachment.
|
||||||
* @param string $path The new filepath of the attachment.
|
*
|
||||||
|
* @param string $path the new filepath of the attachment
|
||||||
|
*
|
||||||
* @return Attachment
|
* @return Attachment
|
||||||
*/
|
*/
|
||||||
public function setPath(string $path): self
|
public function setPath(string $path): self
|
||||||
|
@ -396,7 +386,6 @@ abstract class Attachment extends NamedDBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AttachmentType $attachement_type
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setAttachmentType(AttachmentType $attachement_type): self
|
public function setAttachmentType(AttachmentType $attachement_type): self
|
||||||
|
@ -410,7 +399,6 @@ abstract class Attachment extends NamedDBElement
|
||||||
* Sets the url associated with this attachment.
|
* Sets the url associated with this attachment.
|
||||||
* If the url is empty nothing is changed, to not override the file path.
|
* If the url is empty nothing is changed, to not override the file path.
|
||||||
*
|
*
|
||||||
* @param string|null $url
|
|
||||||
* @return Attachment
|
* @return Attachment
|
||||||
*/
|
*/
|
||||||
public function setURL(?string $url): self
|
public function setURL(?string $url): self
|
||||||
|
@ -438,7 +426,7 @@ abstract class Attachment extends NamedDBElement
|
||||||
*
|
*
|
||||||
* @param string $path The path that should be checked
|
* @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
|
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.
|
* 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 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.
|
* @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.*
|
* *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.
|
* Removes the given attachment from this element.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function removeAttachment(Attachment $attachment): self
|
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.
|
* Gets an filter, which file types are allowed for attachment files.
|
||||||
* Must be in the format of <input type=file> accept attribute
|
* 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).
|
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getFiletypeFilter(): string
|
public function getFiletypeFilter(): string
|
||||||
{
|
{
|
||||||
|
@ -98,7 +96,9 @@ class AttachmentType extends StructuralDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the filetype filter pattern.
|
* Sets the filetype filter pattern.
|
||||||
|
*
|
||||||
* @param string $filetype_filter The new filetype filter
|
* @param string $filetype_filter The new filetype filter
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setFiletypeFilter(string $filetype_filter): self
|
public function setFiletypeFilter(string $filetype_filter): self
|
||||||
|
|
|
@ -31,7 +31,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
class AttachmentTypeAttachment extends Attachment
|
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\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @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
|
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\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -173,8 +173,6 @@ abstract class Company extends PartsContainingDBElement
|
||||||
* Set the addres.
|
* Set the addres.
|
||||||
*
|
*
|
||||||
* @param string $new_address the new address (with "\n" as line break)
|
* @param string $new_address the new address (with "\n" as line break)
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setAddress(string $new_address): self
|
public function setAddress(string $new_address): self
|
||||||
{
|
{
|
||||||
|
@ -187,8 +185,6 @@ abstract class Company extends PartsContainingDBElement
|
||||||
* Set the phone number.
|
* Set the phone number.
|
||||||
*
|
*
|
||||||
* @param string $new_phone_number the new phone number
|
* @param string $new_phone_number the new phone number
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setPhoneNumber(string $new_phone_number): self
|
public function setPhoneNumber(string $new_phone_number): self
|
||||||
{
|
{
|
||||||
|
@ -201,8 +197,6 @@ abstract class Company extends PartsContainingDBElement
|
||||||
* Set the fax number.
|
* Set the fax number.
|
||||||
*
|
*
|
||||||
* @param string $new_fax_number the new fax number
|
* @param string $new_fax_number the new fax number
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setFaxNumber(string $new_fax_number): self
|
public function setFaxNumber(string $new_fax_number): self
|
||||||
{
|
{
|
||||||
|
@ -215,8 +209,6 @@ abstract class Company extends PartsContainingDBElement
|
||||||
* Set the e-mail address.
|
* Set the e-mail address.
|
||||||
*
|
*
|
||||||
* @param string $new_email_address the new e-mail address
|
* @param string $new_email_address the new e-mail address
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setEmailAddress(string $new_email_address): self
|
public function setEmailAddress(string $new_email_address): self
|
||||||
{
|
{
|
||||||
|
@ -229,8 +221,6 @@ abstract class Company extends PartsContainingDBElement
|
||||||
* Set the website.
|
* Set the website.
|
||||||
*
|
*
|
||||||
* @param string $new_website the new website
|
* @param string $new_website the new website
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setWebsite(string $new_website): 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.
|
* Set the link to the website of an article.
|
||||||
*
|
*
|
||||||
* @param string $new_url the new URL with the placeholder %PARTNUMBER% for the part number
|
* @param string $new_url the new URL with the placeholder %PARTNUMBER% for the part number
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setAutoProductUrl(string $new_url): self
|
public function setAutoProductUrl(string $new_url): self
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,6 @@ trait MasterAttachmentTrait
|
||||||
/**
|
/**
|
||||||
* Sets the new master picture for this part.
|
* Sets the new master picture for this part.
|
||||||
*
|
*
|
||||||
* @param Attachment|null $new_master_attachment
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setMasterPictureAttachment(?Attachment $new_master_attachment)
|
public function setMasterPictureAttachment(?Attachment $new_master_attachment)
|
||||||
|
|
|
@ -29,14 +29,14 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
trait TimestampTrait
|
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"})
|
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
|
||||||
* @Groups({"extended", "full"})
|
* @Groups({"extended", "full"})
|
||||||
*/
|
*/
|
||||||
protected $lastModified;
|
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"})
|
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
|
||||||
* @Groups({"extended", "full"})
|
* @Groups({"extended", "full"})
|
||||||
*/
|
*/
|
||||||
|
@ -46,7 +46,7 @@ trait TimestampTrait
|
||||||
* Returns the last time when the element was modified.
|
* Returns the last time when the element was modified.
|
||||||
* Returns null if the element was not yet saved to DB yet.
|
* 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
|
public function getLastModified(): ?\DateTime
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ trait TimestampTrait
|
||||||
* Returns the date/time when the element was created.
|
* Returns the date/time when the element was created.
|
||||||
* Returns null if the element was not yet saved to DB yet.
|
* 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
|
public function getAddedDate(): ?\DateTime
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,7 +133,8 @@ class Device extends PartsContainingDBElement
|
||||||
/**
|
/**
|
||||||
* Set the order quantity.
|
* Set the order quantity.
|
||||||
*
|
*
|
||||||
* @param int $new_order_quantity the new order quantity
|
* @param int $new_order_quantity the new order quantity
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setOrderQuantity(int $new_order_quantity): self
|
public function setOrderQuantity(int $new_order_quantity): self
|
||||||
|
@ -150,6 +151,7 @@ class Device extends PartsContainingDBElement
|
||||||
* Set the "order_only_missing_parts" attribute.
|
* Set the "order_only_missing_parts" attribute.
|
||||||
*
|
*
|
||||||
* @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute
|
* @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute
|
||||||
|
*
|
||||||
* @return Device
|
* @return Device
|
||||||
*/
|
*/
|
||||||
public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self
|
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 'C'.sprintf('%09d', $this->getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPartnameHint(): string
|
public function getPartnameHint(): string
|
||||||
{
|
{
|
||||||
return $this->partname_hint;
|
return $this->partname_hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $partname_hint
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setPartnameHint(string $partname_hint): self
|
public function setPartnameHint(string $partname_hint): self
|
||||||
|
@ -136,16 +132,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPartnameRegex(): string
|
public function getPartnameRegex(): string
|
||||||
{
|
{
|
||||||
return $this->partname_regex;
|
return $this->partname_regex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $partname_regex
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setPartnameRegex(string $partname_regex): self
|
public function setPartnameRegex(string $partname_regex): self
|
||||||
|
@ -155,16 +147,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isDisableFootprints(): bool
|
public function isDisableFootprints(): bool
|
||||||
{
|
{
|
||||||
return $this->disable_footprints;
|
return $this->disable_footprints;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $disable_footprints
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setDisableFootprints(bool $disable_footprints): self
|
public function setDisableFootprints(bool $disable_footprints): self
|
||||||
|
@ -174,16 +162,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isDisableManufacturers(): bool
|
public function isDisableManufacturers(): bool
|
||||||
{
|
{
|
||||||
return $this->disable_manufacturers;
|
return $this->disable_manufacturers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $disable_manufacturers
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setDisableManufacturers(bool $disable_manufacturers): self
|
public function setDisableManufacturers(bool $disable_manufacturers): self
|
||||||
|
@ -193,16 +177,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isDisableAutodatasheets(): bool
|
public function isDisableAutodatasheets(): bool
|
||||||
{
|
{
|
||||||
return $this->disable_autodatasheets;
|
return $this->disable_autodatasheets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $disable_autodatasheets
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setDisableAutodatasheets(bool $disable_autodatasheets): self
|
public function setDisableAutodatasheets(bool $disable_autodatasheets): self
|
||||||
|
@ -212,16 +192,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isDisableProperties(): bool
|
public function isDisableProperties(): bool
|
||||||
{
|
{
|
||||||
return $this->disable_properties;
|
return $this->disable_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $disable_properties
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setDisableProperties(bool $disable_properties): self
|
public function setDisableProperties(bool $disable_properties): self
|
||||||
|
@ -231,16 +207,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDefaultDescription(): string
|
public function getDefaultDescription(): string
|
||||||
{
|
{
|
||||||
return $this->default_description;
|
return $this->default_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $default_description
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setDefaultDescription(string $default_description): self
|
public function setDefaultDescription(string $default_description): self
|
||||||
|
@ -250,16 +222,12 @@ class Category extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDefaultComment(): string
|
public function getDefaultComment(): string
|
||||||
{
|
{
|
||||||
return $this->default_comment;
|
return $this->default_comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $default_comment
|
|
||||||
* @return Category
|
* @return Category
|
||||||
*/
|
*/
|
||||||
public function setDefaultComment(string $default_comment): self
|
public function setDefaultComment(string $default_comment): self
|
||||||
|
|
|
@ -110,8 +110,6 @@ class Footprint extends PartsContainingDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the 3D Model associated with this footprint.
|
* Returns the 3D Model associated with this footprint.
|
||||||
*
|
|
||||||
* @return FootprintAttachment|null
|
|
||||||
*/
|
*/
|
||||||
public function getFootprint3d(): ?FootprintAttachment
|
public function getFootprint3d(): ?FootprintAttachment
|
||||||
{
|
{
|
||||||
|
@ -128,6 +126,7 @@ class Footprint extends PartsContainingDBElement
|
||||||
* Sets the 3D Model associated with this footprint.
|
* Sets the 3D Model associated with this footprint.
|
||||||
*
|
*
|
||||||
* @param FootprintAttachment|null $new_attachment The new 3D Model
|
* @param FootprintAttachment|null $new_attachment The new 3D Model
|
||||||
|
*
|
||||||
* @return Footprint
|
* @return Footprint
|
||||||
*/
|
*/
|
||||||
public function setFootprint3d(?FootprintAttachment $new_attachment): self
|
public function setFootprint3d(?FootprintAttachment $new_attachment): self
|
||||||
|
|
|
@ -113,16 +113,12 @@ class MeasurementUnit extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isInteger(): bool
|
public function isInteger(): bool
|
||||||
{
|
{
|
||||||
return $this->is_integer;
|
return $this->is_integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $isInteger
|
|
||||||
* @return MeasurementUnit
|
* @return MeasurementUnit
|
||||||
*/
|
*/
|
||||||
public function setIsInteger(bool $isInteger): self
|
public function setIsInteger(bool $isInteger): self
|
||||||
|
@ -132,16 +128,12 @@ class MeasurementUnit extends PartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isUseSIPrefix(): bool
|
public function isUseSIPrefix(): bool
|
||||||
{
|
{
|
||||||
return $this->use_si_prefix;
|
return $this->use_si_prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $usesSIPrefixes
|
|
||||||
* @return MeasurementUnit
|
* @return MeasurementUnit
|
||||||
*/
|
*/
|
||||||
public function setUseSIPrefix(bool $usesSIPrefixes): self
|
public function setUseSIPrefix(bool $usesSIPrefixes): self
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Part extends AttachmentContainingDBElement
|
||||||
protected $addedDate;
|
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")
|
* @ColumnSecurity(type="datetime")
|
||||||
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
|
* @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.
|
* 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.
|
* @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
|
* @throws \Exception If an error with the DateTime occurs
|
||||||
*/
|
*/
|
||||||
public function isExpired(): ?bool
|
public function isExpired(): ?bool
|
||||||
|
@ -137,7 +138,6 @@ class PartLot extends DBElement
|
||||||
/**
|
/**
|
||||||
* Sets the description of the part lot.
|
* Sets the description of the part lot.
|
||||||
*
|
*
|
||||||
* @param string $description
|
|
||||||
* @return PartLot
|
* @return PartLot
|
||||||
*/
|
*/
|
||||||
public function setDescription(string $description): self
|
public function setDescription(string $description): self
|
||||||
|
@ -160,7 +160,6 @@ class PartLot extends DBElement
|
||||||
/**
|
/**
|
||||||
* Sets the comment for this part lot.
|
* Sets the comment for this part lot.
|
||||||
*
|
*
|
||||||
* @param string $comment
|
|
||||||
* @return PartLot
|
* @return PartLot
|
||||||
*/
|
*/
|
||||||
public function setComment(string $comment): self
|
public function setComment(string $comment): self
|
||||||
|
@ -207,7 +206,6 @@ class PartLot extends DBElement
|
||||||
/**
|
/**
|
||||||
* Sets the storage location, where this part lot is stored.
|
* Sets the storage location, where this part lot is stored.
|
||||||
*
|
*
|
||||||
* @param Storelocation|null $storage_location
|
|
||||||
* @return PartLot
|
* @return PartLot
|
||||||
*/
|
*/
|
||||||
public function setStorageLocation(?Storelocation $storage_location): self
|
public function setStorageLocation(?Storelocation $storage_location): self
|
||||||
|
@ -254,7 +252,6 @@ class PartLot extends DBElement
|
||||||
/**
|
/**
|
||||||
* Set the unknown instock status of this part lot.
|
* Set the unknown instock status of this part lot.
|
||||||
*
|
*
|
||||||
* @param bool $instock_unknown
|
|
||||||
* @return PartLot
|
* @return PartLot
|
||||||
*/
|
*/
|
||||||
public function setInstockUnknown(bool $instock_unknown): self
|
public function setInstockUnknown(bool $instock_unknown): self
|
||||||
|
@ -292,7 +289,6 @@ class PartLot extends DBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $needs_refill
|
|
||||||
* @return PartLot
|
* @return PartLot
|
||||||
*/
|
*/
|
||||||
public function setNeedsRefill(bool $needs_refill): self
|
public function setNeedsRefill(bool $needs_refill): self
|
||||||
|
|
|
@ -37,14 +37,14 @@ trait AdvancedPropertyTrait
|
||||||
protected $needs_review = false;
|
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")
|
* @ORM\Column(type="text")
|
||||||
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
|
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
|
||||||
*/
|
*/
|
||||||
protected $tags = '';
|
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)
|
* @ORM\Column(type="float", nullable=true)
|
||||||
* @ColumnSecurity(type="float", placeholder=null)
|
* @ColumnSecurity(type="float", placeholder=null)
|
||||||
* @Assert\PositiveOrZero()
|
* @Assert\PositiveOrZero()
|
||||||
|
@ -53,8 +53,6 @@ trait AdvancedPropertyTrait
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this part is marked, for that it needs further review.
|
* Checks if this part is marked, for that it needs further review.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isNeedsReview(): bool
|
public function isNeedsReview(): bool
|
||||||
{
|
{
|
||||||
|
@ -63,7 +61,9 @@ trait AdvancedPropertyTrait
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the "needs review" status of this part.
|
* Sets the "needs review" status of this part.
|
||||||
|
*
|
||||||
* @param bool $needs_review The new status
|
* @param bool $needs_review The new status
|
||||||
|
*
|
||||||
* @return Part|self
|
* @return Part|self
|
||||||
*/
|
*/
|
||||||
public function setNeedsReview(bool $needs_review): 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.
|
* Gets a comma separated list, of tags, that are assigned to this part.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getTags(): string
|
public function getTags(): string
|
||||||
{
|
{
|
||||||
|
@ -87,7 +85,6 @@ trait AdvancedPropertyTrait
|
||||||
* Sets a comma separated list of tags, that are assigned to this part.
|
* Sets a comma separated list of tags, that are assigned to this part.
|
||||||
*
|
*
|
||||||
* @param string $tags The new tags
|
* @param string $tags The new tags
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setTags(string $tags): self
|
public function setTags(string $tags): self
|
||||||
{
|
{
|
||||||
|
@ -99,8 +96,6 @@ trait AdvancedPropertyTrait
|
||||||
/**
|
/**
|
||||||
* Returns the mass of a single part unit.
|
* Returns the mass of a single part unit.
|
||||||
* Returns null, if the mass is unknown/not set yet.
|
* Returns null, if the mass is unknown/not set yet.
|
||||||
*
|
|
||||||
* @return float|null
|
|
||||||
*/
|
*/
|
||||||
public function getMass(): ?float
|
public function getMass(): ?float
|
||||||
{
|
{
|
||||||
|
@ -111,8 +106,7 @@ trait AdvancedPropertyTrait
|
||||||
* Sets the mass of a single part unit.
|
* Sets the mass of a single part unit.
|
||||||
* Sett to null, if the mass is unknown.
|
* Sett to null, if the mass is unknown.
|
||||||
*
|
*
|
||||||
* @param float|null $mass The new mass.
|
* @param float|null $mass the new mass
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setMass(?float $mass): self
|
public function setMass(?float $mass): self
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ trait BasicPropertyTrait
|
||||||
protected $visible = true;
|
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")
|
* @ORM\Column(type="boolean")
|
||||||
* @ColumnSecurity(type="boolean")
|
* @ColumnSecurity(type="boolean")
|
||||||
*/
|
*/
|
||||||
|
@ -111,7 +111,7 @@ trait BasicPropertyTrait
|
||||||
* Check if this part is a favorite.
|
* Check if this part is a favorite.
|
||||||
*
|
*
|
||||||
* @return bool * true 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
|
public function isFavorite(): bool
|
||||||
{
|
{
|
||||||
|
@ -143,8 +143,6 @@ trait BasicPropertyTrait
|
||||||
* Sets the description of this part.
|
* Sets the description of this part.
|
||||||
*
|
*
|
||||||
* @param string $new_description the new description
|
* @param string $new_description the new description
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setDescription(?string $new_description): self
|
public function setDescription(?string $new_description): self
|
||||||
{
|
{
|
||||||
|
@ -157,8 +155,6 @@ trait BasicPropertyTrait
|
||||||
* Sets the comment property of this part.
|
* Sets the comment property of this part.
|
||||||
*
|
*
|
||||||
* @param string $new_comment the new comment
|
* @param string $new_comment the new comment
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setComment(string $new_comment): 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).
|
* 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
|
* @param Category $category The new category of this part
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setCategory(Category $category): 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
|
* @param Footprint|null $new_footprint The new footprint of this part. Set to null, if this part should not have
|
||||||
* a footprint.
|
* a footprint.
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setFootprint(?Footprint $new_footprint): 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.
|
* @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.
|
* Set this to true, when the part should be a favorite.
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setFavorite(bool $new_favorite_status): self
|
public function setFavorite(bool $new_favorite_status): self
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ trait InstockTrait
|
||||||
protected $minamount = 0;
|
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\ManyToOne(targetEntity="MeasurementUnit", inversedBy="parts")
|
||||||
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
|
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
|
||||||
* @ColumnSecurity(type="object", prefix="unit")
|
* @ColumnSecurity(type="object", prefix="unit")
|
||||||
|
@ -69,9 +69,6 @@ trait InstockTrait
|
||||||
/**
|
/**
|
||||||
* Adds the given part lot, to the list of part lots.
|
* Adds the given part lot, to the list of part lots.
|
||||||
* The part lot is assigned to this part.
|
* The part lot is assigned to this part.
|
||||||
*
|
|
||||||
* @param PartLot $lot
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function addPartLot(PartLot $lot): self
|
public function addPartLot(PartLot $lot): self
|
||||||
{
|
{
|
||||||
|
@ -84,9 +81,7 @@ trait InstockTrait
|
||||||
/**
|
/**
|
||||||
* Removes the given part lot from the list of part lots.
|
* Removes the given part lot from the list of part lots.
|
||||||
*
|
*
|
||||||
* @param PartLot $lot The part lot that should be deleted.
|
* @param PartLot $lot the part lot that should be deleted
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function removePartLot(PartLot $lot): self
|
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.
|
* 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.
|
* 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
|
public function getPartUnit(): ?MeasurementUnit
|
||||||
{
|
{
|
||||||
|
@ -109,9 +102,6 @@ trait InstockTrait
|
||||||
/**
|
/**
|
||||||
* Sets the measurement unit in which the part's amount should be measured.
|
* Sets the measurement unit in which the part's amount should be measured.
|
||||||
* Set to null, if the part should be measured in quantities.
|
* Set to null, if the part should be measured in quantities.
|
||||||
*
|
|
||||||
* @param MeasurementUnit|null $partUnit
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setPartUnit(?MeasurementUnit $partUnit): self
|
public function setPartUnit(?MeasurementUnit $partUnit): self
|
||||||
{
|
{
|
||||||
|
@ -182,8 +172,6 @@ trait InstockTrait
|
||||||
* See getPartUnit() for the associated unit.
|
* See getPartUnit() for the associated unit.
|
||||||
*
|
*
|
||||||
* @param float $new_minamount the new count of parts which should be in stock at least
|
* @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
|
public function setMinAmount(float $new_minamount): self
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ trait ManufacturerTrait
|
||||||
protected $manufacturer;
|
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")
|
* @ORM\Column(type="string")
|
||||||
* @Assert\Url()
|
* @Assert\Url()
|
||||||
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
|
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
|
||||||
|
@ -86,7 +86,7 @@ trait ManufacturerTrait
|
||||||
/**
|
/**
|
||||||
* Similar to getManufacturerProductUrl, but here only the database value is returned.
|
* 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
|
public function getCustomProductURL(): string
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,6 @@ trait ManufacturerTrait
|
||||||
* Sets the manufacturing status for this part
|
* Sets the manufacturing status for this part
|
||||||
* See getManufacturingStatus() for valid values.
|
* See getManufacturingStatus() for valid values.
|
||||||
*
|
*
|
||||||
* @param string $manufacturing_status
|
|
||||||
* @return Part
|
* @return Part
|
||||||
*/
|
*/
|
||||||
public function setManufacturingStatus(string $manufacturing_status): self
|
public function setManufacturingStatus(string $manufacturing_status): self
|
||||||
|
@ -137,8 +136,6 @@ trait ManufacturerTrait
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the assigned manufacturer product number (MPN) for this part.
|
* Returns the assigned manufacturer product number (MPN) for this part.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getManufacturerProductNumber(): string
|
public function getManufacturerProductNumber(): string
|
||||||
{
|
{
|
||||||
|
@ -148,7 +145,6 @@ trait ManufacturerTrait
|
||||||
/**
|
/**
|
||||||
* Sets the manufacturer product number (MPN) for this part.
|
* Sets the manufacturer product number (MPN) for this part.
|
||||||
*
|
*
|
||||||
* @param string $manufacturer_product_number
|
|
||||||
* @return Part
|
* @return Part
|
||||||
*/
|
*/
|
||||||
public function setManufacturerProductNumber(string $manufacturer_product_number): self
|
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.
|
* Set to "" if this part should use the automatically URL based on its manufacturer.
|
||||||
*
|
*
|
||||||
* @param string $new_url The new url
|
* @param string $new_url The new url
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setManufacturerProductURL(string $new_url): 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
|
* @param Manufacturer|null $new_manufacturer The new Manufacturer of this part. Set to null, if this part should
|
||||||
* not have a manufacturer.
|
* not have a manufacturer.
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setManufacturer(?Manufacturer $new_manufacturer): self
|
public function setManufacturer(?Manufacturer $new_manufacturer): self
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ use Doctrine\Common\Collections\Collection;
|
||||||
trait OrderTrait
|
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)
|
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||||
* @Assert\Valid()
|
* @Assert\Valid()
|
||||||
* @ColumnSecurity(prefix="orderdetails", type="collection")
|
* @ColumnSecurity(prefix="orderdetails", type="collection")
|
||||||
|
@ -121,9 +121,7 @@ trait OrderTrait
|
||||||
* Adds the given orderdetail to list of orderdetails.
|
* Adds the given orderdetail to list of orderdetails.
|
||||||
* The orderdetail is assigned to this part.
|
* The orderdetail is assigned to this part.
|
||||||
*
|
*
|
||||||
* @param Orderdetail $orderdetail The orderdetail that should be added.
|
* @param Orderdetail $orderdetail the orderdetail that should be added
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function addOrderdetail(Orderdetail $orderdetail): self
|
public function addOrderdetail(Orderdetail $orderdetail): self
|
||||||
{
|
{
|
||||||
|
@ -136,7 +134,6 @@ trait OrderTrait
|
||||||
/**
|
/**
|
||||||
* Removes the given orderdetail from the list of orderdetails.
|
* Removes the given orderdetail from the list of orderdetails.
|
||||||
*
|
*
|
||||||
* @param Orderdetail $orderdetail
|
|
||||||
* @return OrderTrait
|
* @return OrderTrait
|
||||||
*/
|
*/
|
||||||
public function removeOrderdetail(Orderdetail $orderdetail): self
|
public function removeOrderdetail(Orderdetail $orderdetail): self
|
||||||
|
@ -157,8 +154,6 @@ trait OrderTrait
|
||||||
* (if the part has exactly one orderdetails,
|
* (if the part has exactly one orderdetails,
|
||||||
* set this orderdetails as order orderdetails.
|
* set this orderdetails as order orderdetails.
|
||||||
* Otherwise, set "no 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
|
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
|
* @return Storelocation
|
||||||
*/
|
*/
|
||||||
public function setOnlySinglePart(bool $only_single_part): self
|
public function setOnlySinglePart(bool $only_single_part): self
|
||||||
|
@ -166,7 +165,6 @@ class Storelocation extends PartsContainingDBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $limit_to_existing_parts
|
|
||||||
* @return Storelocation
|
* @return Storelocation
|
||||||
*/
|
*/
|
||||||
public function setLimitToExistingParts(bool $limit_to_existing_parts): self
|
public function setLimitToExistingParts(bool $limit_to_existing_parts): self
|
||||||
|
@ -185,7 +183,6 @@ class Storelocation extends PartsContainingDBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param MeasurementUnit|null $storage_type
|
|
||||||
* @return Storelocation
|
* @return Storelocation
|
||||||
*/
|
*/
|
||||||
public function setStorageType(?MeasurementUnit $storage_type): self
|
public function setStorageType(?MeasurementUnit $storage_type): self
|
||||||
|
|
|
@ -127,7 +127,6 @@ class Supplier extends Company
|
||||||
/**
|
/**
|
||||||
* Sets the default currency.
|
* Sets the default currency.
|
||||||
*
|
*
|
||||||
* @param Currency|null $default_currency
|
|
||||||
* @return Supplier
|
* @return Supplier
|
||||||
*/
|
*/
|
||||||
public function setDefaultCurrency(?Currency $default_currency): self
|
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.
|
* Sets the shipping costs for an order with this supplier.
|
||||||
*
|
*
|
||||||
* @param string|null $shipping_costs a bcmath string with the shipping costs
|
* @param string|null $shipping_costs a bcmath string with the shipping costs
|
||||||
|
*
|
||||||
* @return Supplier
|
* @return Supplier
|
||||||
*/
|
*/
|
||||||
public function setShippingCosts(?string $shipping_costs): self
|
public function setShippingCosts(?string $shipping_costs): self
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Currency extends StructuralDBElement
|
||||||
protected $attachments;
|
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")
|
* @ORM\Column(type="string")
|
||||||
* @Assert\Currency()
|
* @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).
|
* Returns the inverse exchange rate (how many of the current currency the base unit is worth).
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getInverseExchangeRate(): ?string
|
public function getInverseExchangeRate(): ?string
|
||||||
{
|
{
|
||||||
|
@ -112,8 +110,6 @@ class Currency extends StructuralDBElement
|
||||||
/**
|
/**
|
||||||
* Returns The exchange rate between this currency and the base currency
|
* Returns The exchange rate between this currency and the base currency
|
||||||
* (how many base units the current currency is worth).
|
* (how many base units the current currency is worth).
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getExchangeRate(): ?string
|
public function getExchangeRate(): ?string
|
||||||
{
|
{
|
||||||
|
@ -122,8 +118,10 @@ class Currency extends StructuralDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the exchange rate of the currency.
|
* Sets the exchange rate of the currency.
|
||||||
|
*
|
||||||
* @param string|null $exchange_rate The new 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
|
* @return Currency
|
||||||
*/
|
*/
|
||||||
public function setExchangeRate(?string $exchange_rate): self
|
public function setExchangeRate(?string $exchange_rate): self
|
||||||
|
|
|
@ -157,7 +157,7 @@ class Orderdetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Get the supplier part-nr.
|
* Get the supplier part-nr.
|
||||||
*
|
*
|
||||||
* @return string the part-nr.
|
* @return string the part-nr
|
||||||
*/
|
*/
|
||||||
public function getSupplierPartNr(): string
|
public function getSupplierPartNr(): string
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,6 @@ class Orderdetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Removes an pricedetail from this orderdetail.
|
* Removes an pricedetail from this orderdetail.
|
||||||
*
|
*
|
||||||
* @param Pricedetail $pricedetail
|
|
||||||
* @return Orderdetail
|
* @return Orderdetail
|
||||||
*/
|
*/
|
||||||
public function removePricedetail(Pricedetail $pricedetail): self
|
public function removePricedetail(Pricedetail $pricedetail): self
|
||||||
|
@ -276,7 +275,6 @@ class Orderdetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Sets a new part with which this orderdetail is associated.
|
* Sets a new part with which this orderdetail is associated.
|
||||||
*
|
*
|
||||||
* @param Part $part
|
|
||||||
* @return Orderdetail
|
* @return Orderdetail
|
||||||
*/
|
*/
|
||||||
public function setPart(Part $part): self
|
public function setPart(Part $part): self
|
||||||
|
@ -289,7 +287,6 @@ class Orderdetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Sets the new supplier associated with this orderdetail.
|
* Sets the new supplier associated with this orderdetail.
|
||||||
*
|
*
|
||||||
* @param Supplier $new_supplier
|
|
||||||
* @return Orderdetail
|
* @return Orderdetail
|
||||||
*/
|
*/
|
||||||
public function setSupplier(Supplier $new_supplier): self
|
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.
|
* Sets the custom product supplier URL for this order detail.
|
||||||
* Set this to "", if the function getSupplierProductURL should return the automatic generated URL.
|
* 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
|
* @return Orderdetail
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -130,7 +130,7 @@ class Pricedetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
|
* 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
|
public function getOrderdetail(): Orderdetail
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ class Pricedetail extends DBElement
|
||||||
* Returns the price associated with this pricedetail.
|
* Returns the price associated with this pricedetail.
|
||||||
* It is given in current currency and for the price related quantity.
|
* 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
|
public function getPrice(): string
|
||||||
{
|
{
|
||||||
|
@ -215,8 +215,6 @@ class Pricedetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Returns the currency associated with this price information.
|
* Returns the currency associated with this price information.
|
||||||
* Returns null, if no specific currency is selected and the global base currency should be assumed.
|
* Returns null, if no specific currency is selected and the global base currency should be assumed.
|
||||||
*
|
|
||||||
* @return Currency|null
|
|
||||||
*/
|
*/
|
||||||
public function getCurrency(): ?Currency
|
public function getCurrency(): ?Currency
|
||||||
{
|
{
|
||||||
|
@ -232,7 +230,6 @@ class Pricedetail extends DBElement
|
||||||
/**
|
/**
|
||||||
* Sets the orderdetail to which this pricedetail belongs to.
|
* Sets the orderdetail to which this pricedetail belongs to.
|
||||||
*
|
*
|
||||||
* @param Orderdetail $orderdetail
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setOrderdetail(Orderdetail $orderdetail): self
|
public function setOrderdetail(Orderdetail $orderdetail): self
|
||||||
|
@ -246,7 +243,6 @@ class Pricedetail extends DBElement
|
||||||
* Sets the currency associated with the price informations.
|
* Sets the currency associated with the price informations.
|
||||||
* Set to null, to use the global base currency.
|
* Set to null, to use the global base currency.
|
||||||
*
|
*
|
||||||
* @param Currency|null $currency
|
|
||||||
* @return Pricedetail
|
* @return Pricedetail
|
||||||
*/
|
*/
|
||||||
public function setCurrency(?Currency $currency): self
|
public function setCurrency(?Currency $currency): self
|
||||||
|
@ -264,8 +260,6 @@ class Pricedetail extends DBElement
|
||||||
* * This is the price for "price_related_quantity" parts!!
|
* * This is the price for "price_related_quantity" parts!!
|
||||||
* * Example: if "price_related_quantity" is '10',
|
* * Example: if "price_related_quantity" is '10',
|
||||||
* you have to set here the price for 10 parts!
|
* you have to set here the price for 10 parts!
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setPrice(string $new_price): 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.
|
* quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically.
|
||||||
*
|
*
|
||||||
* @param float $new_price_related_quantity the price related quantity
|
* @param float $new_price_related_quantity the price related quantity
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setPriceRelatedQuantity(float $new_price_related_quantity): 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.)
|
* So the orderdetails would have three Pricedetails for one supplier.)
|
||||||
*
|
*
|
||||||
* @param float $new_min_discount_quantity the minimum discount quantity
|
* @param float $new_min_discount_quantity the minimum discount quantity
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setMinDiscountQuantity(float $new_min_discount_quantity): 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.
|
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isEnforce2FA(): 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.
|
* 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.
|
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setEnforce2FA(bool $enforce2FA): Group
|
public function setEnforce2FA(bool $enforce2FA): self
|
||||||
{
|
{
|
||||||
$this->enforce2FA = $enforce2FA;
|
$this->enforce2FA = $enforce2FA;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID as an string, defined by the element class.
|
* Returns the ID as an string, defined by the element class.
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
* This should have a form like P000014, for a part with ID 14.
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\Entity\UserSystem;
|
namespace App\Entity\UserSystem;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Base\TimestampTrait;
|
use App\Entity\Base\TimestampTrait;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface;
|
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface;
|
||||||
|
@ -48,41 +47,46 @@ class U2FKey implements TwoFactorKeyInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=64)
|
* @ORM\Column(type="string", length=64)
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
public $keyHandle;
|
public $keyHandle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
public $publicKey;
|
public $publicKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
public $certificate;
|
public $certificate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
|
*
|
||||||
* @var int
|
* @var int
|
||||||
**/
|
**/
|
||||||
public $counter;
|
public $counter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="u2fKeys")
|
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="u2fKeys")
|
||||||
|
*
|
||||||
* @var User
|
* @var User
|
||||||
**/
|
**/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
|
|
||||||
public function fromRegistrationData(Registration $data): void
|
public function fromRegistrationData(Registration $data): void
|
||||||
{
|
{
|
||||||
$this->keyHandle = $data->keyHandle;
|
$this->keyHandle = $data->keyHandle;
|
||||||
|
@ -91,62 +95,61 @@ class U2FKey implements TwoFactorKeyInterface
|
||||||
$this->counter = $data->counter;
|
$this->counter = $data->counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function getKeyHandle()
|
public function getKeyHandle()
|
||||||
{
|
{
|
||||||
return $this->keyHandle;
|
return $this->keyHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function setKeyHandle($keyHandle)
|
public function setKeyHandle($keyHandle)
|
||||||
{
|
{
|
||||||
$this->keyHandle = $keyHandle;
|
$this->keyHandle = $keyHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function getPublicKey()
|
public function getPublicKey()
|
||||||
{
|
{
|
||||||
return $this->publicKey;
|
return $this->publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function setPublicKey($publicKey)
|
public function setPublicKey($publicKey)
|
||||||
{
|
{
|
||||||
$this->publicKey = $publicKey;
|
$this->publicKey = $publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function getCertificate()
|
public function getCertificate()
|
||||||
{
|
{
|
||||||
return $this->certificate;
|
return $this->certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritdoc} */
|
||||||
/** @inheritDoc */
|
|
||||||
public function setCertificate($certificate)
|
public function setCertificate($certificate)
|
||||||
{
|
{
|
||||||
$this->certificate = $certificate;
|
$this->certificate = $certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function getCounter()
|
public function getCounter()
|
||||||
{
|
{
|
||||||
return $this->counter;
|
return $this->counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function setCounter($counter)
|
public function setCounter($counter)
|
||||||
{
|
{
|
||||||
$this->counter = $counter;
|
$this->counter = $counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** {@inheritdoc} */
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
@ -154,30 +157,33 @@ class U2FKey implements TwoFactorKeyInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user, this U2F key belongs to.
|
* Gets the user, this U2F key belongs to.
|
||||||
|
*
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function getUser() : User
|
public function getUser(): User
|
||||||
{
|
{
|
||||||
return $this->user;
|
return $this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The primary key ID of this key
|
* The primary key ID of this key.
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getID() : int
|
public function getID(): int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the user this U2F key belongs to.
|
* Sets the user this U2F key belongs to.
|
||||||
* @param TwoFactorInterface $new_user
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setUser(TwoFactorInterface $new_user) : self
|
public function setUser(TwoFactorInterface $new_user): self
|
||||||
{
|
{
|
||||||
$this->user = $new_user;
|
$this->user = $new_user;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ use App\Validator\Constraints\ValidPermission;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
|
||||||
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorKeyInterface;
|
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorKeyInterface;
|
||||||
use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
|
use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
|
||||||
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
||||||
|
@ -70,7 +71,6 @@ use Scheb\TwoFactorBundle\Model\TrustedDeviceInterface;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
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.
|
* 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`")
|
* @ORM\Table("`users`")
|
||||||
* @UniqueEntity("name", message="validator.user.username_already_used")
|
* @UniqueEntity("name", message="validator.user.username_already_used")
|
||||||
*/
|
*/
|
||||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface,
|
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface
|
||||||
TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface
|
|
||||||
{
|
{
|
||||||
use MasterAttachmentTrait;
|
use MasterAttachmentTrait;
|
||||||
|
|
||||||
|
@ -205,8 +204,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
protected $trustedDeviceCookieVersion = 0;
|
protected $trustedDeviceCookieVersion = 0;
|
||||||
|
|
||||||
/** @var Collection<TwoFactorKeyInterface>
|
/** @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;
|
protected $u2fKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,7 +318,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Sets the password hash for this user.
|
* Sets the password hash for this user.
|
||||||
*
|
*
|
||||||
* @param string $password
|
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setPassword(string $password): self
|
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.
|
* Sets the currency the users prefers to see prices in.
|
||||||
*
|
*
|
||||||
* @param Currency|null $currency
|
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setCurrency(?Currency $currency): self
|
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.
|
* Set the status, if the user needs a password change.
|
||||||
*
|
*
|
||||||
* @param bool $need_pw_change
|
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setNeedPwChange(bool $need_pw_change): self
|
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
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getPwResetToken(): ?string
|
public function getPwResetToken(): ?string
|
||||||
|
@ -442,18 +439,20 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the encrypted password reset token
|
* Sets the encrypted password reset token.
|
||||||
* @param string|null $pw_reset_token
|
*
|
||||||
* @return User
|
* @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;
|
$this->pw_reset_token = $pw_reset_token;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the datetime when the password reset token expires
|
* Gets the datetime when the password reset token expires.
|
||||||
|
*
|
||||||
* @return \DateTime
|
* @return \DateTime
|
||||||
*/
|
*/
|
||||||
public function getPwResetExpires(): \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
|
* Sets the datetime when the password reset token expires.
|
||||||
* @param \DateTime $pw_reset_expires
|
*
|
||||||
* @return User
|
* @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;
|
$this->pw_reset_expires = $pw_reset_expires;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
* Getters
|
* 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.
|
* @param string $new_name The new username.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setName(string $new_name): NamedDBElement
|
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.
|
* Get the first name of the user.
|
||||||
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getFirstName(): ?string
|
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
|
* @param string $first_name The new first name
|
||||||
*
|
*
|
||||||
* @return $this
|
* @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
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getLastName(): ?string
|
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
|
* @param string $last_name The new last name
|
||||||
*
|
*
|
||||||
* @return $this
|
* @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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDepartment(): ?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
|
* @param string $department The new department
|
||||||
|
*
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setDepartment(?string $department): self
|
public function setDepartment(?string $department): self
|
||||||
|
@ -577,6 +584,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the email of the user.
|
* Get the email of the user.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEmail(): ?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
|
* @param string $email The new email adress
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setEmail(?string $email): self
|
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).
|
* 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').
|
* @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
|
public function getLanguage(): ?string
|
||||||
{
|
{
|
||||||
|
@ -608,20 +619,24 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the language the user prefers.
|
* Change the language the user prefers.
|
||||||
|
*
|
||||||
* @param string|null $language The new language as 2 letter ISO code (e.g. 'en' or 'de').
|
* @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
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setLanguage(?string $language): self
|
public function setLanguage(?string $language): self
|
||||||
{
|
{
|
||||||
$this->language = $language;
|
$this->language = $language;
|
||||||
|
|
||||||
return $this;
|
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
|
* @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
|
public function getTimezone(): ?string
|
||||||
{
|
{
|
||||||
|
@ -630,7 +645,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the timezone of this user.
|
* 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.
|
* @param string $timezone|null The new timezone (e.g. 'Europe/Berlin') or null to use the system wide one.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setTimezone(?string $timezone): self
|
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.
|
* 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.
|
* @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
|
public function getTheme(): ?string
|
||||||
|
@ -651,8 +669,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the theme the user wants to see.
|
* 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
|
* @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
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setTheme(?string $theme): self
|
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.
|
* 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.
|
* @return Group|null The group of this user. Null if this user does not have a group.
|
||||||
*/
|
*/
|
||||||
public function getGroup(): ?Group
|
public function getGroup(): ?Group
|
||||||
|
@ -673,7 +694,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the group of this user.
|
* 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.
|
* @param Group|null $group The new group of this user. Set to null if this user should not have a group.
|
||||||
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setGroup(?Group $group): self
|
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).
|
* 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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
$tmp = $this->isDisabled() ? ' [DISABLED]' : '';
|
$tmp = $this->isDisabled() ? ' [DISABLED]' : '';
|
||||||
|
|
||||||
return $this->getFullName(true).$tmp;
|
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 the user name that should be shown in Google Authenticator.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getGoogleAuthenticatorUsername(): 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.
|
* Sets the secret used for Google Authenticator. Set to null to disable Google Authenticator.
|
||||||
* @param string|null $googleAuthenticatorSecret
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): self
|
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): self
|
||||||
{
|
{
|
||||||
$this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
|
$this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,11 +766,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
* Check if the given code is a valid backup code.
|
* Check if the given code is a valid backup code.
|
||||||
*
|
*
|
||||||
* @param string $code The code that should be checked.
|
* @param string $code The code that should be checked.
|
||||||
|
*
|
||||||
* @return bool True if the backup code is valid.
|
* @return bool True if the backup code is valid.
|
||||||
*/
|
*/
|
||||||
public function isBackupCode(string $code): bool
|
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
|
public function invalidateBackupCode(string $code): void
|
||||||
{
|
{
|
||||||
$key = array_search($code, $this->backupCodes);
|
$key = array_search($code, $this->backupCodes);
|
||||||
if ($key !== false){
|
if (false !== $key) {
|
||||||
unset($this->backupCodes[$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
|
* @return string[] An array with all backup codes
|
||||||
*/
|
*/
|
||||||
public function getBackupCodes() : array
|
public function getBackupCodes(): array
|
||||||
{
|
{
|
||||||
return $this->backupCodes ?? [];
|
return $this->backupCodes ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the backup codes for this user. Existing backup codes are overridden.
|
* 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
|
* @return $this
|
||||||
|
*
|
||||||
* @throws \Exception If an error with the datetime occurs
|
* @throws \Exception If an error with the datetime occurs
|
||||||
*/
|
*/
|
||||||
public function setBackupCodes(array $codes) : self
|
public function setBackupCodes(array $codes): self
|
||||||
{
|
{
|
||||||
$this->backupCodes = $codes;
|
$this->backupCodes = $codes;
|
||||||
if(empty($codes)) {
|
if (empty($codes)) {
|
||||||
$this->backupCodesGenerationDate = null;
|
$this->backupCodesGenerationDate = null;
|
||||||
} else {
|
} else {
|
||||||
$this->backupCodesGenerationDate = new \DateTime();
|
$this->backupCodesGenerationDate = new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the date when the backup codes were generated.
|
* Return the date when the backup codes were generated.
|
||||||
|
*
|
||||||
* @return \DateTime|null
|
* @return \DateTime|null
|
||||||
*/
|
*/
|
||||||
public function getBackupCodesGenerationDate() : ?\DateTime
|
public function getBackupCodesGenerationDate(): ?\DateTime
|
||||||
{
|
{
|
||||||
return $this->backupCodesGenerationDate;
|
return $this->backupCodesGenerationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return version for the trusted device token. Increase version to invalidate all trusted token of the user.
|
* 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
|
* @return int The version of trusted device token
|
||||||
*/
|
*/
|
||||||
public function getTrustedTokenVersion(): int
|
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.
|
* Invalidate all trusted device tokens at once, by incrementing the token version.
|
||||||
* You have to flush the changes to database afterwards.
|
* 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
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isU2FAuthEnabled(): 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>
|
* @return Collection<TwoFactorKeyInterface>
|
||||||
*/
|
*/
|
||||||
public function getU2FKeys(): Collection
|
public function getU2FKeys(): Collection
|
||||||
|
@ -832,7 +869,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a U2F key to this user.
|
* Add a U2F key to this user.
|
||||||
* @param TwoFactorKeyInterface $key
|
|
||||||
*/
|
*/
|
||||||
public function addU2FKey(TwoFactorKeyInterface $key): void
|
public function addU2FKey(TwoFactorKeyInterface $key): void
|
||||||
{
|
{
|
||||||
|
@ -841,7 +877,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a U2F key from this user.
|
* Remove a U2F key from this user.
|
||||||
* @param TwoFactorKeyInterface $key
|
|
||||||
*/
|
*/
|
||||||
public function removeU2FKey(TwoFactorKeyInterface $key): void
|
public function removeU2FKey(TwoFactorKeyInterface $key): void
|
||||||
{
|
{
|
||||||
|
@ -849,12 +884,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getPreferredTwoFactorProvider(): ?string
|
public function getPreferredTwoFactorProvider(): ?string
|
||||||
{
|
{
|
||||||
//If U2F is available then prefer it
|
//If U2F is available then prefer it
|
||||||
if($this->isU2FAuthEnabled()) {
|
if ($this->isU2FAuthEnabled()) {
|
||||||
return 'u2f_two_factor';
|
return 'u2f_two_factor';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\EventSubscriber;
|
namespace App\EventSubscriber;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\Mailer\Event\MessageEvent;
|
use Symfony\Component\Mailer\Event\MessageEvent;
|
||||||
use Symfony\Component\Mime\Address;
|
use Symfony\Component\Mime\Address;
|
||||||
|
@ -34,7 +33,7 @@ class MailFromListener implements EventSubscriberInterface
|
||||||
|
|
||||||
public function __construct(string $email, string $name)
|
public function __construct(string $email, string $name)
|
||||||
{
|
{
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,4 +54,4 @@ class MailFromListener implements EventSubscriberInterface
|
||||||
MessageEvent::class => ['onMessage'],
|
MessageEvent::class => ['onMessage'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\EventSubscriber;
|
namespace App\EventSubscriber;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
||||||
|
@ -34,18 +33,16 @@ use Symfony\Component\Security\Http\HttpUtils;
|
||||||
* This event subscriber redirects a user to its settings page, when it needs to change its password or is enforced
|
* This event subscriber redirects a user to its settings page, when it needs to change its password or is enforced
|
||||||
* to setup a 2FA method (enforcement can be set per group).
|
* to setup a 2FA method (enforcement can be set per group).
|
||||||
* In this cases the user is unable to access sites other than the whitelisted (see ALLOWED_ROUTES).
|
* In this cases the user is unable to access sites other than the whitelisted (see ALLOWED_ROUTES).
|
||||||
* @package App\EventSubscriber
|
|
||||||
*/
|
*/
|
||||||
class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $security;
|
protected $security;
|
||||||
protected $flashBag;
|
protected $flashBag;
|
||||||
protected $httpUtils;
|
protected $httpUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] The routes the user is allowed to access without being redirected.
|
* @var string[] The routes the user is allowed to access without being redirected.
|
||||||
* This should be only routes related to login/logout and user settings
|
* This should be only routes related to login/logout and user settings
|
||||||
*/
|
*/
|
||||||
public const ALLOWED_ROUTES = [
|
public const ALLOWED_ROUTES = [
|
||||||
'2fa_login',
|
'2fa_login',
|
||||||
|
@ -69,17 +66,16 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
* This function is called when the kernel encounters a request.
|
* This function is called when the kernel encounters a request.
|
||||||
* It checks if the user must change its password or add an 2FA mehtod and redirect it to the user settings page,
|
* It checks if the user must change its password or add an 2FA mehtod and redirect it to the user settings page,
|
||||||
* if needed.
|
* if needed.
|
||||||
* @param RequestEvent $event
|
|
||||||
*/
|
*/
|
||||||
public function redirectToSettingsIfNeeded(RequestEvent $event) : void
|
public function redirectToSettingsIfNeeded(RequestEvent $event): void
|
||||||
{
|
{
|
||||||
$user = $this->security->getUser();
|
$user = $this->security->getUser();
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
|
|
||||||
if(!$event->isMasterRequest()) {
|
if (!$event->isMasterRequest()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!$user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,35 +94,36 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
|
|
||||||
/* Dont redirect tree endpoints, as this would cause trouble and creates multiple flash
|
/* Dont redirect tree endpoints, as this would cause trouble and creates multiple flash
|
||||||
warnigs for one page reload */
|
warnigs for one page reload */
|
||||||
if(strpos($request->getUri(), '/tree/') !== false) {
|
if (false !== strpos($request->getUri(), '/tree/')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Show appropriate message to user about the reason he was redirected
|
//Show appropriate message to user about the reason he was redirected
|
||||||
if($user->isNeedPwChange()) {
|
if ($user->isNeedPwChange()) {
|
||||||
$this->flashBag->add('warning', 'user.pw_change_needed.flash');
|
$this->flashBag->add('warning', 'user.pw_change_needed.flash');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(static::TFARedirectNeeded($user)) {
|
if (static::TFARedirectNeeded($user)) {
|
||||||
$this->flashBag->add('warning', 'user.2fa_needed.flash');
|
$this->flashBag->add('warning', 'user.2fa_needed.flash');
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setResponse($this->httpUtils->createRedirectResponse($request, static::REDIRECT_TARGET));
|
$event->setResponse($this->httpUtils->createRedirectResponse($request, static::REDIRECT_TARGET));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a redirect because of a missing 2FA method is needed.
|
* Check if a redirect because of a missing 2FA method is needed.
|
||||||
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
|
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
|
||||||
* U2F key setup.
|
* U2F key setup.
|
||||||
* @param User $user The user for which should be checked if it needs to be redirected.
|
*
|
||||||
|
* @param User $user The user for which should be checked if it needs to be redirected.
|
||||||
|
*
|
||||||
* @return bool True if the user needs to be redirected.
|
* @return bool True if the user needs to be redirected.
|
||||||
*/
|
*/
|
||||||
public static function TFARedirectNeeded(User $user) : bool
|
public static function TFARedirectNeeded(User $user): bool
|
||||||
{
|
{
|
||||||
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
|
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
|
||||||
|
|
||||||
if ($user->getGroup() !== null && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
|
if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +131,7 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
|
@ -142,4 +139,4 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
KernelEvents::REQUEST => 'redirectToSettingsIfNeeded',
|
KernelEvents::REQUEST => 'redirectToSettingsIfNeeded',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\EventSubscriber;
|
namespace App\EventSubscriber;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\UserSystem\U2FKey;
|
use App\Entity\UserSystem\U2FKey;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use R\U2FTwoFactorBundle\Event\RegisterEvent;
|
use R\U2FTwoFactorBundle\Event\RegisterEvent;
|
||||||
|
@ -51,9 +50,9 @@ class U2FRegistrationSubscriber implements EventSubscriberInterface
|
||||||
/** @return string[] **/
|
/** @return string[] **/
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'r_u2f_two_factor.register' => 'onRegister',
|
'r_u2f_two_factor.register' => 'onRegister',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onRegister(RegisterEvent $event): void
|
public function onRegister(RegisterEvent $event): void
|
||||||
|
@ -78,4 +77,4 @@ class U2FRegistrationSubscriber implements EventSubscriberInterface
|
||||||
$response = new RedirectResponse($this->router->generate('user_settings'));
|
$response = new RedirectResponse($this->router->generate('user_settings'));
|
||||||
$event->setResponse($response);
|
$event->setResponse($response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ use Symfony\Component\Form\CallbackTransformer;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class AttachmentTypeAdminForm extends BaseEntityAdminForm
|
class AttachmentTypeAdminForm extends BaseEntityAdminForm
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class BaseEntityAdminForm extends AbstractType
|
class BaseEntityAdminForm extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -65,7 +64,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('name', TextType::class, ['empty_data' => '', 'label' => 'name.label',
|
->add('name', TextType::class, ['empty_data' => '', 'label' => 'name.label',
|
||||||
'attr' => ['placeholder' =>'part.name.placeholder'],
|
'attr' => ['placeholder' => 'part.name.placeholder'],
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
|
||||||
|
|
||||||
->add('parent', StructuralEntityType::class, ['class' => \get_class($entity),
|
->add('parent', StructuralEntityType::class, ['class' => \get_class($entity),
|
||||||
|
|
|
@ -36,7 +36,7 @@ class GroupAdminForm extends BaseEntityAdminForm
|
||||||
'label' => 'group.edit.enforce_2fa',
|
'label' => 'group.edit.enforce_2fa',
|
||||||
'help' => 'entity.edit.enforce_2fa.help',
|
'help' => 'entity.edit.enforce_2fa.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity)
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('permissions', PermissionsType::class, [
|
$builder->add('permissions', PermissionsType::class, [
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class ImportType extends AbstractType
|
class ImportType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class MassCreationForm extends AbstractType
|
class MassCreationForm extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use Symfony\Component\Validator\Constraints\File;
|
use Symfony\Component\Validator\Constraints\File;
|
||||||
use Symfony\Component\Validator\Constraints\Url;
|
use Symfony\Component\Validator\Constraints\Url;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class AttachmentFormType extends AbstractType
|
class AttachmentFormType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,13 +36,12 @@ use Symfony\Component\Form\FormEvent;
|
||||||
use Symfony\Component\Form\FormEvents;
|
use Symfony\Component\Form\FormEvents;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class OrderdetailType extends AbstractType
|
class OrderdetailType extends AbstractType
|
||||||
{
|
{
|
||||||
protected $security;
|
protected $security;
|
||||||
|
|
||||||
public function __construct( Security $security)
|
public function __construct(Security $security)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class PartBaseType extends AbstractType
|
class PartBaseType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class PartLotType extends AbstractType
|
class PartLotType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ class PricedetailType extends AbstractType
|
||||||
]);
|
]);
|
||||||
$builder->add('currency', CurrencyEntityType::class, [
|
$builder->add('currency', CurrencyEntityType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => false
|
'label' => false,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Validator\Constraints\ValidGoogleAuthCode;
|
use App\Validator\Constraints\ValidGoogleAuthCode;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
@ -33,11 +32,9 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Form\FormEvent;
|
use Symfony\Component\Form\FormEvent;
|
||||||
use Symfony\Component\Form\FormEvents;
|
use Symfony\Component\Form\FormEvents;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class TFAGoogleSettingsType extends AbstractType
|
class TFAGoogleSettingsType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $translator;
|
protected $translator;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -46,20 +43,20 @@ class TFAGoogleSettingsType extends AbstractType
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
|
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
|
||||||
$form = $event->getForm();
|
$form = $event->getForm();
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $event->getData();
|
$user = $event->getData();
|
||||||
|
|
||||||
//Only show setup fields, when google authenticator is not enabled
|
//Only show setup fields, when google authenticator is not enabled
|
||||||
if(!$user->isGoogleAuthenticatorEnabled()) {
|
if (!$user->isGoogleAuthenticatorEnabled()) {
|
||||||
$form->add(
|
$form->add(
|
||||||
'google_confirmation',
|
'google_confirmation',
|
||||||
TextType::class,
|
TextType::class,
|
||||||
[
|
[
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'attr' => ['maxlength' => '6', 'minlength' => '6', 'pattern' => '\d*', 'autocomplete' => 'off'],
|
'attr' => ['maxlength' => '6', 'minlength' => '6', 'pattern' => '\d*', 'autocomplete' => 'off'],
|
||||||
'constraints' => [new ValidGoogleAuthCode()]
|
'constraints' => [new ValidGoogleAuthCode()],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -72,12 +69,12 @@ class TFAGoogleSettingsType extends AbstractType
|
||||||
);
|
);
|
||||||
|
|
||||||
$form->add('submit', SubmitType::class, [
|
$form->add('submit', SubmitType::class, [
|
||||||
'label' => 'tfa_google.enable'
|
'label' => 'tfa_google.enable',
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$form->add('submit', SubmitType::class, [
|
$form->add('submit', SubmitType::class, [
|
||||||
'label' =>'tfa_google.disable',
|
'label' => 'tfa_google.disable',
|
||||||
'attr' => ['class' => 'btn-danger']
|
'attr' => ['class' => 'btn-danger'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -91,4 +88,4 @@ class TFAGoogleSettingsType extends AbstractType
|
||||||
'data_class' => User::class,
|
'data_class' => User::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Component\Validator\Constraints\Length;
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class UserAdminForm extends AbstractType
|
class UserAdminForm extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,6 @@ use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class UserSettingsType extends AbstractType
|
class UserSettingsType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,9 @@ class BBCodeToMarkdownConverter
|
||||||
* Converts the given BBCode to markdown.
|
* Converts the given BBCode to markdown.
|
||||||
* BBCode tags that does not have a markdown aequivalent are outputed as HTML tags.
|
* BBCode tags that does not have a markdown aequivalent are outputed as HTML tags.
|
||||||
*
|
*
|
||||||
* @param $bbcode string The Markdown that should be converted.
|
* @param $bbcode string The Markdown that should be converted
|
||||||
*
|
*
|
||||||
* @return string The markdown version of the text.
|
* @return string the markdown version of the text
|
||||||
*/
|
*/
|
||||||
public function convert(string $bbcode): string
|
public function convert(string $bbcode): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,10 +21,8 @@
|
||||||
|
|
||||||
namespace App\Helpers\Trees;
|
namespace App\Helpers\Trees;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Base\StructuralDBElement;
|
use App\Entity\Base\StructuralDBElement;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use RecursiveIterator;
|
|
||||||
|
|
||||||
class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIterator
|
class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIterator
|
||||||
{
|
{
|
||||||
|
@ -37,22 +35,24 @@ class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIt
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function hasChildren()
|
public function hasChildren()
|
||||||
{
|
{
|
||||||
/** @var StructuralDBElement $element */
|
/** @var StructuralDBElement $element */
|
||||||
$element = $this->current();
|
$element = $this->current();
|
||||||
|
|
||||||
return !empty($element->getSubelements());
|
return !empty($element->getSubelements());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getChildren()
|
public function getChildren()
|
||||||
{
|
{
|
||||||
/** @var StructuralDBElement $element */
|
/** @var StructuralDBElement $element */
|
||||||
$element = $this->current();
|
$element = $this->current();
|
||||||
return new StructuralDBElementIterator($element->getSubelements()->toArray());
|
|
||||||
|
return new self($element->getSubelements()->toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,6 @@
|
||||||
|
|
||||||
namespace App\Helpers\Trees;
|
namespace App\Helpers\Trees;
|
||||||
|
|
||||||
use App\Entity\Base\DBElement;
|
|
||||||
use App\Entity\Base\NamedDBElement;
|
|
||||||
use App\Entity\Base\StructuralDBElement;
|
|
||||||
use App\Helpers\Trees\TreeViewNodeState;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a node for the bootstrap treeview node.
|
* This class represents a node for the bootstrap treeview node.
|
||||||
* When you serialize an array of these objects to JSON, you can use the serialized data in data for the treeview.
|
* When you serialize an array of these objects to JSON, you can use the serialized data in data for the treeview.
|
||||||
|
@ -63,9 +58,10 @@ class TreeViewNode implements \JsonSerializable
|
||||||
/**
|
/**
|
||||||
* Return the ID of the entity associated with this node.
|
* Return the ID of the entity associated with this node.
|
||||||
* Null if this node is not connected with an entity.
|
* Null if this node is not connected with an entity.
|
||||||
|
*
|
||||||
* @return int|null
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
public function getId() : ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
@ -73,12 +69,13 @@ class TreeViewNode implements \JsonSerializable
|
||||||
/**
|
/**
|
||||||
* Sets the ID of the entity associated with this node.
|
* Sets the ID of the entity associated with this node.
|
||||||
* Null if this node is not connected with an entity.
|
* Null if this node is not connected with an entity.
|
||||||
* @param int|null $id
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setId(?int $id): self
|
public function setId(?int $id): self
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,27 +205,27 @@ class TreeViewNode implements \JsonSerializable
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
$ret = [
|
$ret = [
|
||||||
'text' => $this->text
|
'text' => $this->text,
|
||||||
];
|
];
|
||||||
|
|
||||||
if($this->href !== null) {
|
if (null !== $this->href) {
|
||||||
$ret['href'] = $this->href;
|
$ret['href'] = $this->href;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->tags !== null) {
|
if (null !== $this->tags) {
|
||||||
$ret['tags'] = $this->tags;
|
$ret['tags'] = $this->tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->nodes !== null) {
|
if (null !== $this->nodes) {
|
||||||
$ret['nodes'] = $this->nodes;
|
$ret['nodes'] = $this->nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->state !== null) {
|
if (null !== $this->state) {
|
||||||
$ret['state'] = $this->state;
|
$ret['state'] = $this->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,8 @@
|
||||||
|
|
||||||
namespace App\Helpers\Trees;
|
namespace App\Helpers\Trees;
|
||||||
|
|
||||||
use App\Helpers\Trees\TreeViewNode;
|
|
||||||
|
|
||||||
class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
|
class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $nodes TreeViewNode[]
|
* @param $nodes TreeViewNode[]
|
||||||
*/
|
*/
|
||||||
|
@ -35,22 +32,24 @@ class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function hasChildren()
|
public function hasChildren()
|
||||||
{
|
{
|
||||||
/** @var TreeViewNode $element */
|
/** @var TreeViewNode $element */
|
||||||
$element = $this->current();
|
$element = $this->current();
|
||||||
|
|
||||||
return !empty($element->getNodes());
|
return !empty($element->getNodes());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getChildren()
|
public function getChildren()
|
||||||
{
|
{
|
||||||
/** @var TreeViewNode $element */
|
/** @var TreeViewNode $element */
|
||||||
$element = $this->current();
|
$element = $this->current();
|
||||||
return new TreeViewNodeIterator($element->getNodes());
|
|
||||||
|
return new self($element->getNodes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,20 +75,20 @@ class TreeViewNodeState implements \JsonSerializable
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
$ret = [];
|
$ret = [];
|
||||||
if ($this->selected !== null) {
|
if (null !== $this->selected) {
|
||||||
$ret['selected'] = $this->selected;
|
$ret['selected'] = $this->selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->disabled !== null) {
|
if (null !== $this->disabled) {
|
||||||
$ret['disabled'] = $this->disabled;
|
$ret['disabled'] = $this->disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->expanded !== null) {
|
if (null !== $this->expanded) {
|
||||||
$ret['expanded'] = $this->expanded;
|
$ret['expanded'] = $this->expanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ final class Version20190913141126 extends AbstractMigration
|
||||||
WHERE id = 2 AND name = "readonly";';
|
WHERE id = 2 AND name = "readonly";';
|
||||||
|
|
||||||
$this->addSql($sql);
|
$this->addSql($sql);
|
||||||
|
|
||||||
$sql = 'UPDATE `groups`
|
$sql = 'UPDATE `groups`
|
||||||
SET perms_parts_category = 5, perms_parts_minamount = 5, perms_parts_lots = 85, perms_parts_tags= 5,
|
SET perms_parts_category = 5, perms_parts_minamount = 5, perms_parts_lots = 85, perms_parts_tags= 5,
|
||||||
perms_parts_unit = 5, perms_parts_mass = 5, perms_parts_status = 5, perms_parts_mpn = 5,
|
perms_parts_unit = 5, perms_parts_mass = 5, perms_parts_status = 5, perms_parts_mpn = 5,
|
||||||
|
|
|
@ -31,15 +31,15 @@ use Doctrine\Migrations\AbstractMigration;
|
||||||
*/
|
*/
|
||||||
final class Version20191214153125 extends AbstractMigration
|
final class Version20191214153125 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function getDescription() : string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
$this->addSql('CREATE TABLE u2f_keys (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, key_handle VARCHAR(64) NOT NULL, public_key VARCHAR(255) NOT NULL, certificate LONGTEXT NOT NULL, counter VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_4F4ADB4BA76ED395 (user_id), UNIQUE INDEX user_unique (user_id, key_handle), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
|
$this->addSql('CREATE TABLE u2f_keys (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, key_handle VARCHAR(64) NOT NULL, public_key VARCHAR(255) NOT NULL, certificate LONGTEXT NOT NULL, counter VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_4F4ADB4BA76ED395 (user_id), UNIQUE INDEX user_unique (user_id, key_handle), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
|
||||||
$this->addSql('ALTER TABLE u2f_keys ADD CONSTRAINT FK_4F4ADB4BA76ED395 FOREIGN KEY (user_id) REFERENCES `users` (id)');
|
$this->addSql('ALTER TABLE u2f_keys ADD CONSTRAINT FK_4F4ADB4BA76ED395 FOREIGN KEY (user_id) REFERENCES `users` (id)');
|
||||||
|
@ -47,10 +47,10 @@ final class Version20191214153125 extends AbstractMigration
|
||||||
$this->addSql('ALTER TABLE users ADD google_authenticator_secret VARCHAR(255) DEFAULT NULL, ADD backup_codes LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', ADD backup_codes_generation_date DATETIME DEFAULT NULL, ADD trusted_device_cookie_version INT NOT NULL');
|
$this->addSql('ALTER TABLE users ADD google_authenticator_secret VARCHAR(255) DEFAULT NULL, ADD backup_codes LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', ADD backup_codes_generation_date DATETIME DEFAULT NULL, ADD trusted_device_cookie_version INT NOT NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
$this->addSql('DROP TABLE u2f_keys');
|
$this->addSql('DROP TABLE u2f_keys');
|
||||||
$this->addSql('ALTER TABLE `groups` DROP enforce_2fa');
|
$this->addSql('ALTER TABLE `groups` DROP enforce_2fa');
|
||||||
|
|
|
@ -21,20 +21,19 @@
|
||||||
|
|
||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Base\NamedDBElement;
|
use App\Entity\Base\NamedDBElement;
|
||||||
use App\Helpers\Trees\TreeViewNode;
|
use App\Helpers\Trees\TreeViewNode;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
|
|
||||||
class NamedDBElementRepository extends EntityRepository
|
class NamedDBElementRepository extends EntityRepository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
|
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
|
||||||
* The treeview is generic, that means the href are null and ID values are set.
|
* The treeview is generic, that means the href are null and ID values are set.
|
||||||
|
*
|
||||||
* @return TreeViewNode[]
|
* @return TreeViewNode[]
|
||||||
*/
|
*/
|
||||||
public function getGenericNodeTree() : array
|
public function getGenericNodeTree(): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
|
@ -48,4 +47,4 @@ class NamedDBElementRepository extends EntityRepository
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,15 @@ class StructuralDBElementRepository extends NamedDBElementRepository
|
||||||
return $this->findBy(['parent' => null], ['name' => 'ASC']);
|
return $this->findBy(['parent' => null], ['name' => 'ASC']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
|
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
|
||||||
* The treeview is generic, that means the href are null and ID values are set.
|
* The treeview is generic, that means the href are null and ID values are set.
|
||||||
* @param StructuralDBElement|null $parent The parent the root elements should have.
|
*
|
||||||
|
* @param StructuralDBElement|null $parent The parent the root elements should have.
|
||||||
|
*
|
||||||
* @return TreeViewNode[]
|
* @return TreeViewNode[]
|
||||||
*/
|
*/
|
||||||
public function getGenericNodeTree(?StructuralDBElement $parent = null) : array
|
public function getGenericNodeTree(?StructuralDBElement $parent = null): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
|
||||||
//$result = iterator_to_array($recursiveIterator);
|
//$result = iterator_to_array($recursiveIterator);
|
||||||
|
|
||||||
//We can not use iterator_to_array here or we get only the parent elements
|
//We can not use iterator_to_array here or we get only the parent elements
|
||||||
foreach($recursiveIterator as $item) {
|
foreach ($recursiveIterator as $item) {
|
||||||
$result[] = $item;
|
$result[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,9 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
|
||||||
*
|
*
|
||||||
* @return User|null
|
* @return User|null
|
||||||
*/
|
*/
|
||||||
public function getAnonymousUser() : ?User
|
public function getAnonymousUser(): ?User
|
||||||
{
|
{
|
||||||
if ($this->anonymous_user === null) {
|
if (null === $this->anonymous_user) {
|
||||||
$this->anonymous_user = $this->findOneBy([
|
$this->anonymous_user = $this->findOneBy([
|
||||||
'id' => User::ID_ANONYMOUS,
|
'id' => User::ID_ANONYMOUS,
|
||||||
]);
|
]);
|
||||||
|
@ -55,10 +55,12 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a user by its name or its email. Useful for login or password reset purposes.
|
* Find a user by its name or its email. Useful for login or password reset purposes.
|
||||||
|
*
|
||||||
* @param string $name_or_password The username or the email of the user that should be found
|
* @param string $name_or_password The username or the email of the user that should be found
|
||||||
|
*
|
||||||
* @return User|null The user if it is existing, null if no one matched the criteria
|
* @return User|null The user if it is existing, null if no one matched the criteria
|
||||||
*/
|
*/
|
||||||
public function findByEmailOrName(string $name_or_password) : ?User
|
public function findByEmailOrName(string $name_or_password): ?User
|
||||||
{
|
{
|
||||||
if (empty($name_or_password)) {
|
if (empty($name_or_password)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -79,7 +81,7 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
|
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,16 +80,18 @@ class ElementPermissionListener
|
||||||
/**
|
/**
|
||||||
* Checks if access to the property of the given element is granted.
|
* Checks if access to the property of the given element is granted.
|
||||||
* This function adds an additional cache layer, where the voters are called only once (to improve performance).
|
* This function adds an additional cache layer, where the voters are called only once (to improve performance).
|
||||||
* @param string $mode What operation should be checked. Must be 'read' or 'edit'
|
*
|
||||||
|
* @param string $mode What operation should be checked. Must be 'read' or 'edit'
|
||||||
* @param ColumnSecurity $annotation The annotation of the property that should be checked
|
* @param ColumnSecurity $annotation The annotation of the property that should be checked
|
||||||
* @param DBElement $element The element that should for which should be checked
|
* @param DBElement $element The element that should for which should be checked
|
||||||
|
*
|
||||||
* @return bool True if the user is allowed to read that property
|
* @return bool True if the user is allowed to read that property
|
||||||
*/
|
*/
|
||||||
protected function isGranted(string $mode, ColumnSecurity $annotation, DBElement $element) : bool
|
protected function isGranted(string $mode, ColumnSecurity $annotation, DBElement $element): bool
|
||||||
{
|
{
|
||||||
if ($mode === 'read') {
|
if ('read' === $mode) {
|
||||||
$operation = $annotation->getReadOperationName();
|
$operation = $annotation->getReadOperationName();
|
||||||
} elseif ($mode === 'edit') {
|
} elseif ('edit' === $mode) {
|
||||||
$operation = $annotation->getEditOperationName();
|
$operation = $annotation->getEditOperationName();
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException('$mode must be either "read" or "edit"!');
|
throw new \InvalidArgumentException('$mode must be either "read" or "edit"!');
|
||||||
|
@ -101,12 +103,11 @@ class ElementPermissionListener
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if we have already have saved the permission, otherwise save it to cache
|
//Check if we have already have saved the permission, otherwise save it to cache
|
||||||
if (!isset($this->perm_cache[$mode][get_class($element)][$operation])) {
|
if (!isset($this->perm_cache[$mode][\get_class($element)][$operation])) {
|
||||||
$this->perm_cache[$mode][get_class($element)][$operation] = $this->security->isGranted($operation, $element);
|
$this->perm_cache[$mode][\get_class($element)][$operation] = $this->security->isGranted($operation, $element);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->perm_cache[$mode][get_class($element)][$operation];
|
return $this->perm_cache[$mode][\get_class($element)][$operation];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,13 +26,11 @@ use Symfony\Component\Security\Core\Exception\AccountStatusException;
|
||||||
use Symfony\Component\Security\Core\Exception\DisabledException;
|
use Symfony\Component\Security\Core\Exception\DisabledException;
|
||||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
class UserChecker implements UserCheckerInterface
|
class UserChecker implements UserCheckerInterface
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,8 +32,6 @@ class AttachmentVoter extends ExtendedVoter
|
||||||
*
|
*
|
||||||
* @param $attribute
|
* @param $attribute
|
||||||
* @param $subject
|
* @param $subject
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,6 @@ abstract class ExtendedVoter extends Voter
|
||||||
*
|
*
|
||||||
* @param $attribute
|
* @param $attribute
|
||||||
* @param $subject
|
* @param $subject
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
|
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ class GroupVoter extends ExtendedVoter
|
||||||
*
|
*
|
||||||
* @param $attribute
|
* @param $attribute
|
||||||
* @param $subject
|
* @param $subject
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,8 +35,6 @@ class PermissionVoter extends ExtendedVoter
|
||||||
*
|
*
|
||||||
* @param $attribute
|
* @param $attribute
|
||||||
* @param $subject
|
* @param $subject
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,9 +54,9 @@ class StructureVoter extends ExtendedVoter
|
||||||
/**
|
/**
|
||||||
* Maps a instance type to the permission name.
|
* Maps a instance type to the permission name.
|
||||||
*
|
*
|
||||||
* @param $subject mixed The subject for which the permission name should be generated.
|
* @param $subject mixed The subject for which the permission name should be generated
|
||||||
*
|
*
|
||||||
* @return string|null The name of the permission for the subject's type or null, if the subject is not supported.
|
* @return string|null the name of the permission for the subject's type or null, if the subject is not supported
|
||||||
*/
|
*/
|
||||||
protected function instanceToPermissionName($subject): ?string
|
protected function instanceToPermissionName($subject): ?string
|
||||||
{
|
{
|
||||||
|
@ -91,8 +91,6 @@ class StructureVoter extends ExtendedVoter
|
||||||
*
|
*
|
||||||
* @param $attribute
|
* @param $attribute
|
||||||
* @param $subject
|
* @param $subject
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,7 @@ class AmountFormatter
|
||||||
*
|
*
|
||||||
* @return string The formatted string
|
* @return string The formatted string
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException Thrown if $value is not numeric.
|
* @throws \InvalidArgumentException thrown if $value is not numeric
|
||||||
*/
|
*/
|
||||||
public function format($value, ?MeasurementUnit $unit = null, array $options = [])
|
public function format($value, ?MeasurementUnit $unit = null, array $options = [])
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,8 +61,6 @@ class AttachmentManager
|
||||||
* or is not existing.
|
* or is not existing.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment The attachment for which the filepath should be determined
|
* @param Attachment $attachment The attachment for which the filepath should be determined
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function toAbsoluteFilePath(Attachment $attachment): ?string
|
public function toAbsoluteFilePath(Attachment $attachment): ?string
|
||||||
{
|
{
|
||||||
|
@ -96,7 +94,7 @@ class AttachmentManager
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment The attachment for which the existence should be checked
|
* @param Attachment $attachment The attachment for which the existence should be checked
|
||||||
*
|
*
|
||||||
* @return bool True if the file is existing.
|
* @return bool true if the file is existing
|
||||||
*/
|
*/
|
||||||
public function isFileExisting(Attachment $attachment): bool
|
public function isFileExisting(Attachment $attachment): bool
|
||||||
{
|
{
|
||||||
|
@ -111,9 +109,7 @@ class AttachmentManager
|
||||||
* Returns the filesize of the attachments in bytes.
|
* Returns the filesize of the attachments in bytes.
|
||||||
* For external attachments or not existing attachments, null is returned.
|
* For external attachments or not existing attachments, null is returned.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment The filesize for which the filesize should be calculated.
|
* @param Attachment $attachment the filesize for which the filesize should be calculated
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
public function getFileSize(Attachment $attachment): ?int
|
public function getFileSize(Attachment $attachment): ?int
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,11 +44,11 @@ class AttachmentPathResolver
|
||||||
/**
|
/**
|
||||||
* AttachmentPathResolver constructor.
|
* AttachmentPathResolver constructor.
|
||||||
*
|
*
|
||||||
* @param string $project_dir The kernel that should be used to resolve the project dir.
|
* @param string $project_dir the kernel that should be used to resolve the project dir
|
||||||
* @param string $media_path The path where uploaded attachments should be stored.
|
* @param string $media_path the path where uploaded attachments should be stored
|
||||||
* @param string|null $footprints_path The path where builtin attachments are stored.
|
* @param string|null $footprints_path The path where builtin attachments are stored.
|
||||||
* Set to null if this ressource should be disabled.
|
* Set to null if this ressource should be disabled.
|
||||||
* @param string|null $models_path Set to null if this ressource should be disabled.
|
* @param string|null $models_path set to null if this ressource should be disabled
|
||||||
*/
|
*/
|
||||||
public function __construct(string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path)
|
public function __construct(string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path)
|
||||||
{
|
{
|
||||||
|
@ -83,8 +83,6 @@ class AttachmentPathResolver
|
||||||
* @internal
|
* @internal
|
||||||
*
|
*
|
||||||
* @param string|null $param_path The parameter value that should be converted to a absolute path
|
* @param string|null $param_path The parameter value that should be converted to a absolute path
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function parameterToAbsolutePath(?string $param_path): ?string
|
public function parameterToAbsolutePath(?string $param_path): ?string
|
||||||
{
|
{
|
||||||
|
@ -120,8 +118,6 @@ class AttachmentPathResolver
|
||||||
* Create an array usable for preg_replace out of an array of placeholders or pathes.
|
* Create an array usable for preg_replace out of an array of placeholders or pathes.
|
||||||
* Slashes and other chars become escaped.
|
* Slashes and other chars become escaped.
|
||||||
* For example: '%TEST%' becomes '/^%TEST%/'.
|
* For example: '%TEST%' becomes '/^%TEST%/'.
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
protected function arrayToRegexArray(array $array): array
|
protected function arrayToRegexArray(array $array): array
|
||||||
{
|
{
|
||||||
|
@ -139,7 +135,7 @@ class AttachmentPathResolver
|
||||||
* Converts an relative placeholder filepath (with %MEDIA% or older %BASE%) to an absolute filepath on disk.
|
* Converts an relative placeholder filepath (with %MEDIA% or older %BASE%) to an absolute filepath on disk.
|
||||||
* The directory separator is always /. Relative pathes are not realy possible (.. is striped).
|
* The directory separator is always /. Relative pathes are not realy possible (.. is striped).
|
||||||
*
|
*
|
||||||
* @param string $placeholder_path The filepath with placeholder for which the real path should be determined.
|
* @param string $placeholder_path the filepath with placeholder for which the real path should be determined
|
||||||
*
|
*
|
||||||
* @return string|null The absolute real path of the file, or null if the placeholder path is invalid
|
* @return string|null The absolute real path of the file, or null if the placeholder path is invalid
|
||||||
*/
|
*/
|
||||||
|
@ -175,7 +171,7 @@ class AttachmentPathResolver
|
||||||
/**
|
/**
|
||||||
* Converts an real absolute filepath to a placeholder version.
|
* Converts an real absolute filepath to a placeholder version.
|
||||||
*
|
*
|
||||||
* @param string $real_path The absolute path, for which the placeholder version should be generated.
|
* @param string $real_path the absolute path, for which the placeholder version should be generated
|
||||||
* @param bool $old_version By default the %MEDIA% placeholder is used, which is directly replaced with the
|
* @param bool $old_version By default the %MEDIA% placeholder is used, which is directly replaced with the
|
||||||
* media directory. If set to true, the old version with %BASE% will be used, which is the project directory.
|
* media directory. If set to true, the old version with %BASE% will be used, which is the project directory.
|
||||||
*
|
*
|
||||||
|
@ -213,7 +209,7 @@ class AttachmentPathResolver
|
||||||
/**
|
/**
|
||||||
* The path where uploaded attachments is stored.
|
* The path where uploaded attachments is stored.
|
||||||
*
|
*
|
||||||
* @return string The absolute path to the media folder.
|
* @return string the absolute path to the media folder
|
||||||
*/
|
*/
|
||||||
public function getMediaPath(): string
|
public function getMediaPath(): string
|
||||||
{
|
{
|
||||||
|
@ -224,7 +220,7 @@ class AttachmentPathResolver
|
||||||
* The path where secured attachments are stored. Must not be located in public/ folder, so it can only be accessed
|
* The path where secured attachments are stored. Must not be located in public/ folder, so it can only be accessed
|
||||||
* via the attachment controller.
|
* via the attachment controller.
|
||||||
*
|
*
|
||||||
* @return string The absolute path to the secure path.
|
* @return string the absolute path to the secure path
|
||||||
*/
|
*/
|
||||||
public function getSecurePath(): string
|
public function getSecurePath(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@ class AttachmentReverseSearch
|
||||||
*
|
*
|
||||||
* @param \SplFileInfo $file The file for which is searched
|
* @param \SplFileInfo $file The file for which is searched
|
||||||
*
|
*
|
||||||
* @return Attachment[] An list of attachments that use the given file.
|
* @return Attachment[] an list of attachments that use the given file
|
||||||
*/
|
*/
|
||||||
public function findAttachmentsByFile(\SplFileInfo $file): array
|
public function findAttachmentsByFile(\SplFileInfo $file): array
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ class AttachmentReverseSearch
|
||||||
* Deletes the given file if it is not used by more than $threshold attachments.
|
* Deletes the given file if it is not used by more than $threshold attachments.
|
||||||
*
|
*
|
||||||
* @param \SplFileInfo $file The file that should be removed
|
* @param \SplFileInfo $file The file that should be removed
|
||||||
* @param int $threshold The threshold used, to determine if a file should be deleted or not.
|
* @param int $threshold the threshold used, to determine if a file should be deleted or not
|
||||||
*
|
*
|
||||||
* @return bool True, if the file was delete. False if not.
|
* @return bool True, if the file was delete. False if not.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,7 +89,7 @@ class AttachmentSubmitHandler
|
||||||
* @param Attachment $attachment The attachment that should be used for generating an attachment
|
* @param Attachment $attachment The attachment that should be used for generating an attachment
|
||||||
* @param string $extension The extension that the new file should have (must only contain chars allowed in pathes)
|
* @param string $extension The extension that the new file should have (must only contain chars allowed in pathes)
|
||||||
*
|
*
|
||||||
* @return string The new filename.
|
* @return string the new filename
|
||||||
*/
|
*/
|
||||||
public function generateAttachmentFilename(Attachment $attachment, string $extension): string
|
public function generateAttachmentFilename(Attachment $attachment, string $extension): string
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ class AttachmentSubmitHandler
|
||||||
* @param Attachment $attachment The attachment that should be used for
|
* @param Attachment $attachment The attachment that should be used for
|
||||||
* @param bool $secure_upload True if the file path should be located in a safe location
|
* @param bool $secure_upload True if the file path should be located in a safe location
|
||||||
*
|
*
|
||||||
* @return string The absolute path for the attachment folder.
|
* @return string the absolute path for the attachment folder
|
||||||
*/
|
*/
|
||||||
public function generateAttachmentPath(Attachment $attachment, bool $secure_upload = false): string
|
public function generateAttachmentPath(Attachment $attachment, bool $secure_upload = false): string
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ class AttachmentSubmitHandler
|
||||||
* Handle the submit of an attachment form.
|
* Handle the submit of an attachment form.
|
||||||
* This function will move the uploaded file or download the URL file to server, if needed.
|
* This function will move the uploaded file or download the URL file to server, if needed.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment The attachment that should be used for handling.
|
* @param Attachment $attachment the attachment that should be used for handling
|
||||||
* @param UploadedFile|null $file If given, that file will be moved to the right location
|
* @param UploadedFile|null $file If given, that file will be moved to the right location
|
||||||
* @param array $options The options to use with the upload. Here you can specify that an URL should be downloaded,
|
* @param array $options The options to use with the upload. Here you can specify that an URL should be downloaded,
|
||||||
* or an file should be moved to a secure location.
|
* or an file should be moved to a secure location.
|
||||||
|
@ -181,8 +181,8 @@ class AttachmentSubmitHandler
|
||||||
/**
|
/**
|
||||||
* Move the given attachment to secure location (or back to public folder) if needed.
|
* Move the given attachment to secure location (or back to public folder) if needed.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment The attachment for which the file should be moved.
|
* @param Attachment $attachment the attachment for which the file should be moved
|
||||||
* @param bool $secure_location This value determines, if the attachment is moved to the secure or public folder.
|
* @param bool $secure_location this value determines, if the attachment is moved to the secure or public folder
|
||||||
*
|
*
|
||||||
* @return Attachment The attachment with the updated filepath
|
* @return Attachment The attachment with the updated filepath
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -53,7 +53,7 @@ class AttachmentURLGenerator
|
||||||
* Converts the absolute file path to a version relative to the public folder, that can be passed to asset
|
* Converts the absolute file path to a version relative to the public folder, that can be passed to asset
|
||||||
* Asset Component functions.
|
* Asset Component functions.
|
||||||
*
|
*
|
||||||
* @param string $absolute_path The absolute path that should be converted.
|
* @param string $absolute_path the absolute path that should be converted
|
||||||
* @param string|null $public_path The public path to which the relative pathes should be created.
|
* @param string|null $public_path The public path to which the relative pathes should be created.
|
||||||
* The path must NOT have a trailing slash!
|
* The path must NOT have a trailing slash!
|
||||||
* If this is set to null, the global public/ folder is used.
|
* If this is set to null, the global public/ folder is used.
|
||||||
|
@ -78,8 +78,6 @@ class AttachmentURLGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a URL under which the attachment file can be viewed.
|
* Returns a URL under which the attachment file can be viewed.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getViewURL(Attachment $attachment): string
|
public function getViewURL(Attachment $attachment): string
|
||||||
{
|
{
|
||||||
|
@ -101,8 +99,6 @@ class AttachmentURLGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a URL to an thumbnail of the attachment file.
|
* Returns a URL to an thumbnail of the attachment file.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): string
|
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): string
|
||||||
{
|
{
|
||||||
|
@ -137,8 +133,6 @@ class AttachmentURLGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a download link to the file associated with the attachment.
|
* Returns a download link to the file associated with the attachment.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getDownloadURL(Attachment $attachment): string
|
public function getDownloadURL(Attachment $attachment): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,7 @@ class BuiltinAttachmentsFinder
|
||||||
* The array is a list of the relative filenames using the %PLACEHOLDERS%.
|
* The array is a list of the relative filenames using the %PLACEHOLDERS%.
|
||||||
* The list contains the files from all configured valid ressoureces.
|
* The list contains the files from all configured valid ressoureces.
|
||||||
*
|
*
|
||||||
* @return array The list of the ressources, or an empty array if an error happened.
|
* @return array the list of the ressources, or an empty array if an error happened
|
||||||
*/
|
*/
|
||||||
public function getListOfRessources(): array
|
public function getListOfRessources(): array
|
||||||
{
|
{
|
||||||
|
@ -92,9 +92,9 @@ class BuiltinAttachmentsFinder
|
||||||
/**
|
/**
|
||||||
* Find all ressources which are matching the given keyword and the specified options.
|
* Find all ressources which are matching the given keyword and the specified options.
|
||||||
*
|
*
|
||||||
* @param string $keyword The keyword you want to search for.
|
* @param string $keyword the keyword you want to search for
|
||||||
* @param array $options Here you can specify some options (see configureOptions for list of options)
|
* @param array $options Here you can specify some options (see configureOptions for list of options)
|
||||||
* @param array|null $base_list The list from which should be used as base for filtering.
|
* @param array|null $base_list the list from which should be used as base for filtering
|
||||||
*
|
*
|
||||||
* @return array The list of the results matching the specified keyword and options
|
* @return array The list of the results matching the specified keyword and options
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -53,9 +53,9 @@ class FileTypeFilterTools
|
||||||
/**
|
/**
|
||||||
* Check if a filetype filter string is valid.
|
* Check if a filetype filter string is valid.
|
||||||
*
|
*
|
||||||
* @param string $filter The filter string that should be validated.
|
* @param string $filter the filter string that should be validated
|
||||||
*
|
*
|
||||||
* @return bool Returns true, if the string is valid.
|
* @return bool returns true, if the string is valid
|
||||||
*/
|
*/
|
||||||
public function validateFilterString(string $filter): bool
|
public function validateFilterString(string $filter): bool
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ class FileTypeFilterTools
|
||||||
* Normalize a filter string. All extensions are converted to lowercase, too much whitespaces are removed.
|
* Normalize a filter string. All extensions are converted to lowercase, too much whitespaces are removed.
|
||||||
* The filter string is not validated.
|
* The filter string is not validated.
|
||||||
*
|
*
|
||||||
* @param string $filter The filter string that should be normalized.
|
* @param string $filter the filter string that should be normalized
|
||||||
*
|
*
|
||||||
* @return string The normalized filter string
|
* @return string The normalized filter string
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +131,7 @@ class FileTypeFilterTools
|
||||||
/**
|
/**
|
||||||
* Get a list of all file extensions that matches the given filter string.
|
* Get a list of all file extensions that matches the given filter string.
|
||||||
*
|
*
|
||||||
* @param string $filter A valid filetype filter string.
|
* @param string $filter a valid filetype filter string
|
||||||
*
|
*
|
||||||
* @return string[] An array of allowed extensions ['txt', 'csv', 'gif']
|
* @return string[] An array of allowed extensions ['txt', 'csv', 'gif']
|
||||||
*/
|
*/
|
||||||
|
@ -166,10 +166,10 @@ class FileTypeFilterTools
|
||||||
/**
|
/**
|
||||||
* Check if the given extension matches the filter.
|
* Check if the given extension matches the filter.
|
||||||
*
|
*
|
||||||
* @param string $filter The filter which should be used for checking.
|
* @param string $filter the filter which should be used for checking
|
||||||
* @param string $extension The extension that should be checked.
|
* @param string $extension the extension that should be checked
|
||||||
*
|
*
|
||||||
* @return bool Returns true, if the extension is allowed with the given filter.
|
* @return bool returns true, if the extension is allowed with the given filter
|
||||||
*/
|
*/
|
||||||
public function isExtensionAllowed(string $filter, string $extension): bool
|
public function isExtensionAllowed(string $filter, string $extension): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ class PartPreviewGenerator
|
||||||
* The priority is: Part MasterAttachment -> Footprint MasterAttachment -> Category MasterAttachment
|
* The priority is: Part MasterAttachment -> Footprint MasterAttachment -> Category MasterAttachment
|
||||||
* -> Storelocation Attachment -> MeasurementUnit Attachment -> ManufacturerAttachment.
|
* -> Storelocation Attachment -> MeasurementUnit Attachment -> ManufacturerAttachment.
|
||||||
*
|
*
|
||||||
* @param Part $part The part for which the attachments should be determined.
|
* @param Part $part the part for which the attachments should be determined
|
||||||
*
|
*
|
||||||
* @return Attachment[]
|
* @return Attachment[]
|
||||||
*/
|
*/
|
||||||
|
@ -97,8 +97,6 @@ class PartPreviewGenerator
|
||||||
* The returned attachment is guaranteed to be existing and be a picture.
|
* The returned attachment is guaranteed to be existing and be a picture.
|
||||||
*
|
*
|
||||||
* @param Part $part The part for which the attachment should be determined
|
* @param Part $part The part for which the attachment should be determined
|
||||||
*
|
|
||||||
* @return Attachment|null
|
|
||||||
*/
|
*/
|
||||||
public function getTablePreviewAttachment(Part $part): ?Attachment
|
public function getTablePreviewAttachment(Part $part): ?Attachment
|
||||||
{
|
{
|
||||||
|
@ -123,9 +121,9 @@ class PartPreviewGenerator
|
||||||
/**
|
/**
|
||||||
* Checks if a attachment is exising and a valid picture.
|
* Checks if a attachment is exising and a valid picture.
|
||||||
*
|
*
|
||||||
* @param Attachment|null $attachment The attachment that should be checked.
|
* @param Attachment|null $attachment the attachment that should be checked
|
||||||
*
|
*
|
||||||
* @return bool True if the attachment is valid.
|
* @return bool true if the attachment is valid
|
||||||
*/
|
*/
|
||||||
protected function isAttachmentValidPicture(?Attachment $attachment): bool
|
protected function isAttachmentValidPicture(?Attachment $attachment): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,22 +21,21 @@
|
||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
|
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
|
||||||
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
|
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
|
||||||
|
|
||||||
class CustomEnvVarProcessor implements EnvVarProcessorInterface
|
class CustomEnvVarProcessor implements EnvVarProcessorInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getEnv($prefix, $name, \Closure $getEnv)
|
public function getEnv($prefix, $name, \Closure $getEnv)
|
||||||
{
|
{
|
||||||
if ('validMailDSN' === $prefix) {
|
if ('validMailDSN' === $prefix) {
|
||||||
try {
|
try {
|
||||||
$env = $getEnv($name);
|
$env = $getEnv($name);
|
||||||
return !empty($env) && $env !== 'null://null';
|
|
||||||
|
return !empty($env) && 'null://null' !== $env;
|
||||||
} catch (EnvNotFoundException $exception) {
|
} catch (EnvNotFoundException $exception) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +43,7 @@ class CustomEnvVarProcessor implements EnvVarProcessorInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function getProvidedTypes()
|
public static function getProvidedTypes()
|
||||||
{
|
{
|
||||||
|
@ -52,4 +51,4 @@ class CustomEnvVarProcessor implements EnvVarProcessorInterface
|
||||||
'validMailDSN' => 'bool',
|
'validMailDSN' => 'bool',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,9 @@ class ElementTypeNameGenerator
|
||||||
*
|
*
|
||||||
* @param DBElement $entity The element for which the label should be generated
|
* @param DBElement $entity The element for which the label should be generated
|
||||||
*
|
*
|
||||||
* @return string The locatlized label for the entity type.
|
* @return string the locatlized label for the entity type
|
||||||
*
|
*
|
||||||
* @throws EntityNotSupportedException When the passed entity is not supported.
|
* @throws EntityNotSupportedException when the passed entity is not supported
|
||||||
*/
|
*/
|
||||||
public function getLocalizedTypeLabel(DBElement $entity): string
|
public function getLocalizedTypeLabel(DBElement $entity): string
|
||||||
{
|
{
|
||||||
|
@ -107,11 +107,12 @@ class ElementTypeNameGenerator
|
||||||
* For example this could be something like: "Part: BC547".
|
* For example this could be something like: "Part: BC547".
|
||||||
* It uses getLocalizedLabel to determine the type.
|
* It uses getLocalizedLabel to determine the type.
|
||||||
*
|
*
|
||||||
* @param NamedDBElement $entity The entity for which the string should be generated.
|
* @param NamedDBElement $entity the entity for which the string should be generated
|
||||||
* @param bool $use_html If set to true, a html string is returned, where the type is set italic
|
* @param bool $use_html If set to true, a html string is returned, where the type is set italic
|
||||||
*
|
*
|
||||||
* @return string The localized string
|
* @return string The localized string
|
||||||
* @throws EntityNotSupportedException When the passed entity is not supported.
|
*
|
||||||
|
* @throws EntityNotSupportedException when the passed entity is not supported
|
||||||
*/
|
*/
|
||||||
public function getTypeNameCombination(NamedDBElement $entity, bool $use_html = false): string
|
public function getTypeNameCombination(NamedDBElement $entity, bool $use_html = false): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,9 +43,9 @@ class EntityExporter
|
||||||
* Exports an Entity or an array of entities to multiple file formats.
|
* Exports an Entity or an array of entities to multiple file formats.
|
||||||
*
|
*
|
||||||
* @param $entity NamedDBElement|NamedDBElement[] The element/elements[] that should be exported
|
* @param $entity NamedDBElement|NamedDBElement[] The element/elements[] that should be exported
|
||||||
* @param Request $request The request that should be used for option resolving.
|
* @param Request $request the request that should be used for option resolving
|
||||||
*
|
*
|
||||||
* @return Response The generated response containing the exported data.
|
* @return Response the generated response containing the exported data
|
||||||
*
|
*
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
use App\Entity\Base\DBElement;
|
|
||||||
use App\Entity\Base\StructuralDBElement;
|
use App\Entity\Base\StructuralDBElement;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\HttpFoundation\File\File;
|
use Symfony\Component\HttpFoundation\File\File;
|
||||||
|
@ -59,10 +58,10 @@ class EntityImporter
|
||||||
*
|
*
|
||||||
* @param string $lines The list of names seperated by \n
|
* @param string $lines The list of names seperated by \n
|
||||||
* @param string $class_name The name of the class for which the entities should be created
|
* @param string $class_name The name of the class for which the entities should be created
|
||||||
* @param StructuralDBElement|null $parent The element which will be used as parent element for new elements.
|
* @param StructuralDBElement|null $parent the element which will be used as parent element for new elements
|
||||||
* @param array $errors An associative array containing all validation errors.
|
* @param array $errors an associative array containing all validation errors
|
||||||
*
|
*
|
||||||
* @return StructuralDBElement[] An array containing all valid imported entities (with the type $class_name)
|
* @return StructuralDBElement[] An array containing all valid imported entities (with the type $class_name)
|
||||||
*/
|
*/
|
||||||
public function massCreation(string $lines, string $class_name, ?StructuralDBElement $parent = null, array &$errors = []): array
|
public function massCreation(string $lines, string $class_name, ?StructuralDBElement $parent = null, array &$errors = []): array
|
||||||
{
|
{
|
||||||
|
@ -72,7 +71,7 @@ class EntityImporter
|
||||||
if (!is_a($class_name, StructuralDBElement::class, true)) {
|
if (!is_a($class_name, StructuralDBElement::class, true)) {
|
||||||
throw new \InvalidArgumentException('$class_name must be a StructuralDBElement type!');
|
throw new \InvalidArgumentException('$class_name must be a StructuralDBElement type!');
|
||||||
}
|
}
|
||||||
if ($parent !== null && !is_a($parent, $class_name)) {
|
if (null !== $parent && !is_a($parent, $class_name)) {
|
||||||
throw new \InvalidArgumentException('$parent must have the same type as specified in $class_name!');
|
throw new \InvalidArgumentException('$parent must have the same type as specified in $class_name!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ class EntityImporter
|
||||||
|
|
||||||
foreach ($names as $name) {
|
foreach ($names as $name) {
|
||||||
$name = trim($name);
|
$name = trim($name);
|
||||||
if ($name === '') {
|
if ('' === $name) {
|
||||||
//Skip empty lines (StrucuralDBElements must have a name)
|
//Skip empty lines (StrucuralDBElements must have a name)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -108,9 +107,9 @@ class EntityImporter
|
||||||
* This methods deserializes the given file and saves it database.
|
* This methods deserializes the given file and saves it database.
|
||||||
* The imported elements will be checked (validated) before written to database.
|
* The imported elements will be checked (validated) before written to database.
|
||||||
*
|
*
|
||||||
* @param File $file The file that should be used for importing.
|
* @param File $file the file that should be used for importing
|
||||||
* @param string $class_name The class name of the enitity that should be imported.
|
* @param string $class_name the class name of the enitity that should be imported
|
||||||
* @param array $options Options for the import process.
|
* @param array $options options for the import process
|
||||||
*
|
*
|
||||||
* @return array An associative array containing an ConstraintViolationList and the entity name as key are returned,
|
* @return array An associative array containing an ConstraintViolationList and the entity name as key are returned,
|
||||||
* if an error happened during validation. When everything was successfull, the array should be empty.
|
* if an error happened during validation. When everything was successfull, the array should be empty.
|
||||||
|
@ -156,11 +155,11 @@ class EntityImporter
|
||||||
*
|
*
|
||||||
* The imported elements will NOT be validated. If you want to use the result array, you have to validate it by yourself.
|
* The imported elements will NOT be validated. If you want to use the result array, you have to validate it by yourself.
|
||||||
*
|
*
|
||||||
* @param File $file The file that should be used for importing.
|
* @param File $file the file that should be used for importing
|
||||||
* @param string $class_name The class name of the enitity that should be imported.
|
* @param string $class_name the class name of the enitity that should be imported
|
||||||
* @param array $options Options for the import process.
|
* @param array $options options for the import process
|
||||||
*
|
*
|
||||||
* @return array An array containing the deserialized elements.
|
* @return array an array containing the deserialized elements
|
||||||
*/
|
*/
|
||||||
public function fileToEntityArray(File $file, string $class_name, array $options = []): array
|
public function fileToEntityArray(File $file, string $class_name, array $options = []): array
|
||||||
{
|
{
|
||||||
|
@ -198,8 +197,8 @@ class EntityImporter
|
||||||
/**
|
/**
|
||||||
* This functions corrects the parent setting based on the children value of the parent.
|
* This functions corrects the parent setting based on the children value of the parent.
|
||||||
*
|
*
|
||||||
* @param iterable $entities The list of entities that should be fixed.
|
* @param iterable $entities the list of entities that should be fixed
|
||||||
* @param null $parent The parent, to which the entity should be set.
|
* @param null $parent the parent, to which the entity should be set
|
||||||
*/
|
*/
|
||||||
protected function correctParentEntites(iterable $entities, $parent = null)
|
protected function correctParentEntites(iterable $entities, $parent = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ class EntityURLGenerator
|
||||||
* Throws an exception if the entity class is not known to the map.
|
* Throws an exception if the entity class is not known to the map.
|
||||||
*
|
*
|
||||||
* @param array $map The map that should be used for determing the controller
|
* @param array $map The map that should be used for determing the controller
|
||||||
* @param $entity mixed The entity for which the controller name should be determined.
|
* @param $entity mixed The entity for which the controller name should be determined
|
||||||
*
|
*
|
||||||
* @return string The name of the controller fitting the entity class
|
* @return string The name of the controller fitting the entity class
|
||||||
*
|
*
|
||||||
|
@ -93,13 +93,13 @@ class EntityURLGenerator
|
||||||
* For the given types, the [type]URL() functions are called (e.g. infoURL()).
|
* For the given types, the [type]URL() functions are called (e.g. infoURL()).
|
||||||
* Not all entity class and $type combinations are supported.
|
* Not all entity class and $type combinations are supported.
|
||||||
*
|
*
|
||||||
* @param $entity mixed The element for which the page should be generated.
|
* @param $entity mixed The element for which the page should be generated
|
||||||
* @param string $type The page type. Currently supported: 'info', 'edit', 'create', 'clone', 'list'/'list_parts'
|
* @param string $type The page type. Currently supported: 'info', 'edit', 'create', 'clone', 'list'/'list_parts'
|
||||||
*
|
*
|
||||||
* @return string The link to the desired page.
|
* @return string the link to the desired page
|
||||||
*
|
*
|
||||||
* @throws EntityNotSupportedException Thrown if the entity is not supported for the given type.
|
* @throws EntityNotSupportedException thrown if the entity is not supported for the given type
|
||||||
* @throws \InvalidArgumentException Thrown if the givent type is not existing.
|
* @throws \InvalidArgumentException thrown if the givent type is not existing
|
||||||
*/
|
*/
|
||||||
public function getURL($entity, string $type)
|
public function getURL($entity, string $type)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ class EntityURLGenerator
|
||||||
/**
|
/**
|
||||||
* Generates an URL to a page, where info about this entity can be viewed.
|
* Generates an URL to a page, where info about this entity can be viewed.
|
||||||
*
|
*
|
||||||
* @param $entity mixed The entity for which the info should be generated.
|
* @param $entity mixed The entity for which the info should be generated
|
||||||
*
|
*
|
||||||
* @return string The URL to the info page
|
* @return string The URL to the info page
|
||||||
*
|
*
|
||||||
|
@ -188,9 +188,9 @@ class EntityURLGenerator
|
||||||
/**
|
/**
|
||||||
* Generates an URL to a page, where this entity can be edited.
|
* Generates an URL to a page, where this entity can be edited.
|
||||||
*
|
*
|
||||||
* @param $entity mixed The entity for which the edit link should be generated.
|
* @param $entity mixed The entity for which the edit link should be generated
|
||||||
*
|
*
|
||||||
* @return string The URL to the edit page.
|
* @return string the URL to the edit page
|
||||||
*
|
*
|
||||||
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
||||||
*/
|
*/
|
||||||
|
@ -217,9 +217,9 @@ class EntityURLGenerator
|
||||||
/**
|
/**
|
||||||
* Generates an URL to a page, where a entity of this type can be created.
|
* Generates an URL to a page, where a entity of this type can be created.
|
||||||
*
|
*
|
||||||
* @param $entity mixed The entity for which the link should be generated.
|
* @param $entity mixed The entity for which the link should be generated
|
||||||
*
|
*
|
||||||
* @return string The URL to the page.
|
* @return string the URL to the page
|
||||||
*
|
*
|
||||||
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
||||||
*/
|
*/
|
||||||
|
@ -247,9 +247,9 @@ class EntityURLGenerator
|
||||||
* Generates an URL to a page, where a new entity can be created, that has the same informations as the
|
* Generates an URL to a page, where a new entity can be created, that has the same informations as the
|
||||||
* given entity (element cloning).
|
* given entity (element cloning).
|
||||||
*
|
*
|
||||||
* @param $entity mixed The entity for which the link should be generated.
|
* @param $entity mixed The entity for which the link should be generated
|
||||||
*
|
*
|
||||||
* @return string The URL to the page.
|
* @return string the URL to the page
|
||||||
*
|
*
|
||||||
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
||||||
*/
|
*/
|
||||||
|
@ -265,9 +265,9 @@ class EntityURLGenerator
|
||||||
/**
|
/**
|
||||||
* Generates an URL to a page, where all parts are listed, which are contained in the given element.
|
* Generates an URL to a page, where all parts are listed, which are contained in the given element.
|
||||||
*
|
*
|
||||||
* @param $entity mixed The entity for which the link should be generated.
|
* @param $entity mixed The entity for which the link should be generated
|
||||||
*
|
*
|
||||||
* @return string The URL to the page.
|
* @return string the URL to the page
|
||||||
*
|
*
|
||||||
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
* @throws EntityNotSupportedException If the method is not supported for the given Entity
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Attachments\Attachment;
|
use App\Entity\Attachments\Attachment;
|
||||||
|
|
||||||
class FAIconGenerator
|
class FAIconGenerator
|
||||||
|
@ -42,19 +41,21 @@ class FAIconGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Font awesome icon class for a file with the specified extension.
|
* Gets the Font awesome icon class for a file with the specified extension.
|
||||||
* For example 'pdf' gives you 'fa-file-pdf'
|
* For example 'pdf' gives you 'fa-file-pdf'.
|
||||||
|
*
|
||||||
* @param string $extension The file extension (without dot). Must be ASCII chars only!
|
* @param string $extension The file extension (without dot). Must be ASCII chars only!
|
||||||
|
*
|
||||||
* @return string The fontawesome class with leading 'fa-'
|
* @return string The fontawesome class with leading 'fa-'
|
||||||
*/
|
*/
|
||||||
public function fileExtensionToFAType(string $extension) : string
|
public function fileExtensionToFAType(string $extension): string
|
||||||
{
|
{
|
||||||
if ($extension === '') {
|
if ('' === $extension) {
|
||||||
throw new \InvalidArgumentException('You must specify an extension!');
|
throw new \InvalidArgumentException('You must specify an extension!');
|
||||||
}
|
}
|
||||||
//Normalize file extension
|
//Normalize file extension
|
||||||
$extension = strtolower($extension);
|
$extension = strtolower($extension);
|
||||||
foreach (self::EXT_MAPPING as $fa => $exts) {
|
foreach (self::EXT_MAPPING as $fa => $exts) {
|
||||||
if (in_array($extension, $exts, true)) {
|
if (\in_array($extension, $exts, true)) {
|
||||||
return $fa;
|
return $fa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,13 +66,15 @@ class FAIconGenerator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns HTML code to show the given fontawesome icon.
|
* Returns HTML code to show the given fontawesome icon.
|
||||||
* E.g. <i class="fas fa-file-text"></i>
|
* E.g. <i class="fas fa-file-text"></i>.
|
||||||
|
*
|
||||||
* @param string $icon_class The icon which should be shown (e.g. fa-file-text)
|
* @param string $icon_class The icon which should be shown (e.g. fa-file-text)
|
||||||
* @param string $style The style of the icon 'fas'
|
* @param string $style The style of the icon 'fas'
|
||||||
* @param string $options Any other css class attributes like size, etc.
|
* @param string $options Any other css class attributes like size, etc.
|
||||||
|
*
|
||||||
* @return string The final html
|
* @return string The final html
|
||||||
*/
|
*/
|
||||||
public function generateIconHTML(string $icon_class, string $style = 'fas', string $options = '') : string
|
public function generateIconHTML(string $icon_class, string $style = 'fas', string $options = ''): string
|
||||||
{
|
{
|
||||||
//XSS protection
|
//XSS protection
|
||||||
$icon_class = htmlspecialchars($icon_class);
|
$icon_class = htmlspecialchars($icon_class);
|
||||||
|
@ -85,4 +88,4 @@ class FAIconGenerator
|
||||||
$options
|
$options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ class MarkdownParser
|
||||||
* Mark the markdown for rendering.
|
* Mark the markdown for rendering.
|
||||||
* The rendering of markdown is done on client side.
|
* The rendering of markdown is done on client side.
|
||||||
*
|
*
|
||||||
* @param string $markdown The markdown text that should be parsed to html.
|
* @param string $markdown the markdown text that should be parsed to html
|
||||||
* @param bool $inline_mode Only allow inline markdown codes like (*bold* or **italic**), not something like tables
|
* @param bool $inline_mode Only allow inline markdown codes like (*bold* or **italic**), not something like tables
|
||||||
*
|
*
|
||||||
* @return string The markdown in a version that can be parsed on client side.
|
* @return string the markdown in a version that can be parsed on client side
|
||||||
*/
|
*/
|
||||||
public function markForRendering(string $markdown, bool $inline_mode = false): string
|
public function markForRendering(string $markdown, bool $inline_mode = false): string
|
||||||
{
|
{
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue