19declare(strict_types=1);
39 public function __construct(
private string $src_type,
private string $dest_type,
private array $additional_preconditions)
45 return hash(
"sha256", self::class . $this->src_type .
',' . $this->dest_type);
50 return sprintf(
'Copy permissions from %s to %s', $this->src_type, $this->dest_type);
69 if (!$src_ref_id || !$dest_ref_id) {
74 'DELETE FROM rbac_pa WHERE ref_id = %s',
79 'INSERT INTO rbac_pa (ref_id, ops_id, rol_id) SELECT %s AS ref_id, ops_id, rol_id FROM rbac_pa WHERE ref_id = %s',
81 [$dest_ref_id, $src_ref_id]
98 $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';
ALL permissions are copied from the $src_type and all existing permissions are first deleted from $de...
achieve(Environment $environment)
Objectives can be achieved.
getHash()
Get a hash for this objective.
isApplicable(Environment $environment)
Get to know whether the objective is applicable.
firstRefIdOfType(ilDBInterface $db, string $type)
getLabel()
Get a label that describes this objective.
__construct(private string $src_type, private string $dest_type, private array $additional_preconditions)
isNotable()
Get to know if this is an interesting objective for a human.
getPreconditions(Environment $environment)
Objectives might depend on other objectives.
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.