47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace oat\taoItems\migrations;
|
||
|
|
||
|
use Doctrine\DBAL\Schema\Schema;
|
||
|
use oat\taoItems\model\user\TaoItemsRoles;
|
||
|
use oat\tao\scripts\tools\accessControl\SetRolesAccess;
|
||
|
use oat\tao\scripts\tools\migrations\AbstractMigration;
|
||
|
|
||
|
final class Version202108100944252141_taoItems extends AbstractMigration
|
||
|
{
|
||
|
private const CONFIG = [
|
||
|
SetRolesAccess::CONFIG_RULES => [
|
||
|
TaoItemsRoles::ITEM_CONTENT_CREATOR => [
|
||
|
['ext' => 'taoItems', 'mod' => 'ItemContent', 'act' => 'delete'],
|
||
|
],
|
||
|
],
|
||
|
];
|
||
|
|
||
|
public function getDescription(): string
|
||
|
{
|
||
|
return 'Item content creator role to author existing item';
|
||
|
}
|
||
|
|
||
|
public function up(Schema $schema): void
|
||
|
{
|
||
|
$setRolesAccess = $this->propagate(new SetRolesAccess());
|
||
|
$setRolesAccess(
|
||
|
[
|
||
|
'--' . SetRolesAccess::OPTION_CONFIG,
|
||
|
self::CONFIG,
|
||
|
]
|
||
|
);
|
||
|
}
|
||
|
|
||
|
public function down(Schema $schema): void
|
||
|
{
|
||
|
$setRolesAccess = $this->propagate(new SetRolesAccess());
|
||
|
$setRolesAccess([
|
||
|
'--' . SetRolesAccess::OPTION_REVOKE,
|
||
|
'--' . SetRolesAccess::OPTION_CONFIG, self::CONFIG,
|
||
|
]);
|
||
|
}
|
||
|
}
|