-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Attributes): Added relation between Realms and Attributes and At…
…tributeValue to secure attribute access
- Loading branch information
1 parent
b9e2f7a
commit 6f5f477
Showing
20 changed files
with
193 additions
and
34 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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RZ\Roadiz\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20230905140844 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add realm to attribute and attribute_value'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE attribute_values ADD realm_id INT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE attribute_values ADD CONSTRAINT FK_184662BC9DFF5F89 FOREIGN KEY (realm_id) REFERENCES realms (id) ON DELETE SET NULL'); | ||
$this->addSql('CREATE INDEX IDX_184662BC9DFF5F89 ON attribute_values (realm_id)'); | ||
$this->addSql('ALTER TABLE attributes ADD realm_id INT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE attributes ADD CONSTRAINT FK_319B9E709DFF5F89 FOREIGN KEY (realm_id) REFERENCES realms (id) ON DELETE SET NULL'); | ||
$this->addSql('CREATE INDEX IDX_319B9E709DFF5F89 ON attributes (realm_id)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE attribute_values DROP FOREIGN KEY FK_184662BC9DFF5F89'); | ||
$this->addSql('DROP INDEX IDX_184662BC9DFF5F89 ON attribute_values'); | ||
$this->addSql('ALTER TABLE attribute_values DROP realm_id'); | ||
$this->addSql('ALTER TABLE attributes DROP FOREIGN KEY FK_319B9E709DFF5F89'); | ||
$this->addSql('DROP INDEX IDX_319B9E709DFF5F89 ON attributes'); | ||
$this->addSql('ALTER TABLE attributes DROP realm_id'); | ||
} | ||
} |
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
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
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RZ\Roadiz\CoreBundle\Form; | ||
|
||
use RZ\Roadiz\CoreBundle\Model\AttributeValueInterface; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
final class AttributeValueRealmType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder->add('realm', RealmChoiceType::class, [ | ||
'label' => false, | ||
'placeholder' => 'attributeValue.realm.placeholder', | ||
'required' => false, | ||
]); | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->setDefaults([ | ||
'label' => false, | ||
'data_class' => AttributeValueInterface::class, | ||
]); | ||
} | ||
} |
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
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
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
<script src="{{ asset('js/vendor.f2fb807281e9789f4232.js', 'Rozier') }}" defer type="text/javascript"></script> | ||
<script src="{{ asset('js/vendor.3c7e5e0ab2e763c35a6d.js', 'Rozier') }}" defer type="text/javascript"></script> | ||
|
||
<script src="{{ asset('js/app.f2fb807281e9789f4232.js', 'Rozier') }}" defer type="text/javascript"></script> | ||
<script src="{{ asset('js/app.3c7e5e0ab2e763c35a6d.js', 'Rozier') }}" defer type="text/javascript"></script> | ||
|
2 changes: 1 addition & 1 deletion
2
lib/Rozier/src/Resources/views/partials/simple-js-inject.html.twig
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
<script src="{{ asset('js/simple.f2fb807281e9789f4232.js', 'Rozier') }}" defer type="text/javascript"></script> | ||
<script src="{{ asset('js/simple.3c7e5e0ab2e763c35a6d.js', 'Rozier') }}" defer type="text/javascript"></script> | ||
|
2 changes: 1 addition & 1 deletion
2
...c/static/css/app.c9045ea8fbedd28c00ed.css → ...c/static/css/app.d45a1cf8e90fcc4fd94a.css
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...atic/css/app.c9045ea8fbedd28c00ed.css.map → ...atic/css/app.d45a1cf8e90fcc4fd94a.css.map
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.