-
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 #5930 from pmattmann/feature/prototype-checklist
Checklist Prototypes
- Loading branch information
Showing
14 changed files
with
342 additions
and
36 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
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 DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20240912183023 extends AbstractMigration { | ||
public function getDescription(): string { | ||
return 'Checklist.IsPrototype'; | ||
} | ||
|
||
public function up(Schema $schema): void { | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE checklist ADD isPrototype BOOLEAN NOT NULL'); | ||
$this->addSql('ALTER TABLE checklist ALTER campid DROP NOT NULL'); | ||
} | ||
|
||
public function down(Schema $schema): void { | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE SCHEMA public'); | ||
$this->addSql('ALTER TABLE checklist DROP isPrototype'); | ||
$this->addSql('ALTER TABLE checklist ALTER campId SET NOT NULL'); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace App\Security\Voter; | ||
|
||
use App\Entity\Checklist; | ||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; | ||
use Symfony\Component\Security\Core\Authorization\Voter\Voter; | ||
|
||
/** | ||
* @extends Voter<string,Checklist> | ||
*/ | ||
class ChecklistIsPrototypeVoter extends Voter { | ||
public function __construct() {} | ||
|
||
protected function supports($attribute, $subject): bool { | ||
return 'CHECKLIST_IS_PROTOTYPE' === $attribute && $subject instanceof Checklist; | ||
} | ||
|
||
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool { | ||
/** @var Checklist $checklist */ | ||
$checklist = $subject; | ||
|
||
return $checklist->isPrototype; | ||
} | ||
} |
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
Oops, something went wrong.