<?php
$_db_migration_to = '08.04'; // 2.0.0-beta4
if (!isset($migrations) || !is_object($migrations))
	die("This file cannot be executed directly");
$migrations->CheckValid($_db_migration_to);
//===========================================================================================



$migrations->Run('01_update_viewer_rights.php', <<<'DB_UPDATE_FILE'
<?php

// Constant values at the time of the migration
$PROJECT_AGGREGATION = 121;

$VIEW_TASK = (1 << 2);

/** @var \Claromentis\Setup\SetupFacade $migrations */
$db = $migrations->GetDb();

$exempt_role = "Viewer";

$db->query(
	"UPDATE acl_role SET acl_role.rights = acl_role.rights | int:viewer_rights WHERE acl_role.name eq:str:exempt_role",
	$VIEW_TASK,
	$exempt_role
);

DB_UPDATE_FILE
);


//===========================================================================================
$migrations->SetVersion('08.04');
