-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from H2-invent/feature/licenseSystem
Feature/license system
- Loading branch information
Showing
27 changed files
with
770 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqoyqw2cO3aYFzV2T0aA7 | ||
WndQYSrROaNxqneEzlMA/L7yE9yloCo2HUcorerS3Ev/cubUWUAWBSlDjgpXJPyD | ||
P0tv54hrwN3m/1s8V1IVZd99GVrcjP4ZoGlX+iCkza+DrAmIl7LqUkrWec4cLNTo | ||
jnmegXmKnoKUOCcKH5CDohfUMe8uHZbO5avuf/6Wn/lDLt1PT4SIu6+d3h/Pt7Cv | ||
M4SG2T5S421zWaVsZRLEHS++PcXS2JymryX6lqCiUIxYktG2UFOxEDa5moQY5URY | ||
ZP2o95fwM42loayVBKCiPe0XIWn4nA8oMtVx4n4gQGjwg02cKgLnnAK/CaLQ1AUq | ||
EUWvWjOKhGpvvD5EoHwflj4HEIRScTutOzLb1Hf9JC6+Z/JXE0rxMcGc0PHfmJhq | ||
VbRwbvAmHkdgLzjzJklahWfkrg3ph5YGqtYvnilaXgtiZNyPpizkrl2JPJaMjAwn | ||
oOpItcLt/c5yAo/8JQ+8tb6dZQ9/GshRDI2fkXhZ56wq6F3op6yoeYIrvu/TuYMV | ||
/5gCyNWQI6PsROSMo1MrnHgg+wv30MqylK1ELV6mhqP4Hnmj+8zjULrD2Q5fu1zs | ||
AnHzIxCTEprRPDvZKM5M79YsMhoLbPtSl48q5grAcEY8QOZfn+hugfOmBjDWrjna | ||
asPYQPCc/W7ZmJuKVTjiRUUCAwEAAQ== | ||
-----END PUBLIC KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Controller\api; | ||
|
||
use App\Entity\License; | ||
use App\Service\LicenseService; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class APILicenseController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/api/v1/generateLicense", name="api_generate_license",methods={"POST"}) | ||
*/ | ||
public function index(Request $request, LicenseService $licenseService): Response | ||
{ | ||
return new JsonResponse($licenseService->generateNewLicense( | ||
$request->get('license') | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
|
||
namespace App\Entity; | ||
|
||
use App\Repository\LicenseRepository; | ||
use App\Service\LicenseService; | ||
use Doctrine\ORM\EntityManager; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use phpDocumentor\Reflection\Types\This; | ||
|
||
/** | ||
* @ORM\Entity(repositoryClass=LicenseRepository::class) | ||
*/ | ||
class License | ||
{ | ||
|
||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @ORM\Column(type="text") | ||
*/ | ||
private $licenseKey; | ||
|
||
/** | ||
* @ORM\Column(type="text") | ||
*/ | ||
private $license; | ||
|
||
/** | ||
* @ORM\Column(type="datetime") | ||
*/ | ||
private $validUntil; | ||
|
||
/** | ||
* @ORM\Column(type="text") | ||
*/ | ||
private $url; | ||
|
||
|
||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getLicenseKey(): ?string | ||
{ | ||
return $this->licenseKey; | ||
} | ||
|
||
public function setLicenseKey(string $licenseKey): self | ||
{ | ||
$this->licenseKey = $licenseKey; | ||
|
||
return $this; | ||
} | ||
|
||
public function getLicense(): ?string | ||
{ | ||
return $this->license; | ||
} | ||
|
||
public function setLicense(string $license): self | ||
{ | ||
$this->license = $license; | ||
|
||
return $this; | ||
} | ||
|
||
public function getValidUntil(): ?\DateTimeInterface | ||
{ | ||
return $this->validUntil; | ||
} | ||
|
||
public function setValidUntil(\DateTimeInterface $validUntil): self | ||
{ | ||
$this->validUntil = $validUntil; | ||
|
||
return $this; | ||
} | ||
|
||
public function getUrl(): ?string | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function setUrl(string $url): self | ||
{ | ||
$this->url = $url; | ||
|
||
return $this; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Emanuel | ||
* Date: 17.09.2019 | ||
* Time: 20:29 | ||
*/ | ||
|
||
namespace App\Form\Type; | ||
|
||
|
||
use App\Entity\AuditTomAbteilung; | ||
use App\Entity\Server; | ||
use League\CommonMark\Inline\Element\Text; | ||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\Form\Extension\Core\Type\DateTimeType; | ||
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class EnterpriseType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
|
||
$builder | ||
->add('smtpHost', TextType::class, ['required' => false, 'label' => 'label.serverSmtpHostName', 'translation_domain' => 'form']) | ||
->add('smtpPort', TextType::class, ['required' => false, 'label' => 'label.serverSmtpHostPort', 'translation_domain' => 'form']) | ||
->add('smtpEncryption', ChoiceType::class, ['required' => false, 'label' => 'label.serverSmtpEncryption', 'translation_domain' => 'form', 'choices'=> | ||
array('choice.tls'=>'tls','choice.ssl'=>'ssl','choice.none'=>null)]) | ||
->add('smtpUsername', TextType::class, ['required' => false, 'label' => 'label.serverSmtpUsername', 'translation_domain' => 'form']) | ||
->add('smtpPassword', TextType::class, ['required' => false, 'label' => 'label.serverSmtpPassword', 'translation_domain' => 'form']) | ||
->add('smtpEmail', TextType::class, ['required' => false, 'label' => 'label.serverSmtpSenderEmail', 'translation_domain' => 'form']) | ||
->add('smtpSenderName', TextType::class, ['required' => false, 'label' => 'label.serverSmtpSenderName', 'translation_domain' => 'form']) | ||
->add('logoUrl', TextType::class, ['required' => false, 'label' => 'label.serverLintLogo', 'translation_domain' => 'form']) | ||
->add('privacyPolicy', TextType::class, ['required' => false, 'label' => 'label.serverPrivacyPolicy', 'translation_domain' => 'form']) | ||
->add('submit', SubmitType::class, ['attr' => array('class' => 'btn btn-outline-primary'), 'label' => 'label.speichern', 'translation_domain' => 'form']); | ||
|
||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefaults([ | ||
]); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20210212101036 extends AbstractMigration | ||
{ | ||
public function getDescription() : string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema) : void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE TABLE license (id INT AUTO_INCREMENT NOT NULL, license_key LONGTEXT NOT NULL, license LONGTEXT NOT NULL, valid_until DATETIME NOT NULL, url LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||
|
||
} | ||
|
||
public function down(Schema $schema) : void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('DROP TABLE license'); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20210212104128 extends AbstractMigration | ||
{ | ||
public function getDescription() : string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema) : void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE server ADD license_key LONGTEXT DEFAULT NULL'); | ||
} | ||
|
||
public function down(Schema $schema) : void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE server DROP license_key'); | ||
} | ||
} |
Oops, something went wrong.