19declare(strict_types=1);
40 private array $operations,
41 private array $additional_preconditions = []
47 return hash(
"sha256", self::class . $this->type .
',' . join(
',', $this->
operations));
52 return 'Drop permissions ' . join(
', ', $this->
operations) .
' from ' . $this->type;
64 ...$this->additional_preconditions,
77 foreach ($operations as $operation) {
79 $objective->achieve($environment);
86 $ops_id = unserialize($row[
'ops_id'], [
'allowed_classes' =>
false]);
87 $ops_id = array_values(array_filter($ops_id, fn($op) => !in_array($op, $operations,
false)));
89 $db->execute($delete_row, [$row[
'rol_id'],
$ref_id]);
91 $db->execute($update_row, [serialize($ops_id), $row[
'rol_id'],
$ref_id]);
100 return $this->
operations($environment) !== [];
111 'SELECT ops_id FROM rbac_ta WHERE ' .
113 ' AND typ_id IN (SELECT obj_id FROM object_data WHERE title = ' .
118 return array_map(
'intval', array_column(
$db->fetchAll($s),
'ops_id'));
123 $ref_query =
'SELECT ref_id FROM object_reference AS r INNER JOIN object_data AS o ON r.obj_id = o.obj_id where type = %s';
isApplicable(Environment $environment)
Get to know whether the objective is applicable.
getHash()
Get a hash for this objective.
achieve(Environment $environment)
Objectives can be achieved.
getLabel()
Get a label that describes this objective.
isNotable()
Get to know if this is an interesting objective for a human.
getPreconditions(Environment $environment)
Objectives might depend on other objectives.
operations(Environment $environment)
__construct(private string $type, private array $operations, private array $additional_preconditions=[])
firstRefIdOfType(ilDBInterface $db, string $type)
INIFile Parser Early access in init proceess! Avoid further dependencies like logging or other servic...
An environment holds resources to be used in the setup process.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.