3 declare(strict_types=1);
    33     public function __construct(
string $type, 
int $src_id, 
int $dest_id)
    42         return hash(
"sha256", self::class);
    47         return "Clone rbac operation from $this->src_id to $this->dest_id";
    64         $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
    67             "SELECT rpa.rol_id, rpa.ops_id, rpa.ref_id" . PHP_EOL
    68             . 
"FROM rbac_pa rpa" . PHP_EOL
    69             . 
"JOIN object_reference ref ON (ref.ref_id = rpa.ref_id)" . PHP_EOL
    70             . 
"JOIN object_data od ON (od.obj_id = ref.obj_id AND od.type = " . $db->quote($this->type, 
"text") . 
")" . PHP_EOL
    71             . 
"WHERE (" . $db->like(
"ops_id", 
"text", 
"%i:" . $this->src_id . 
"%") . PHP_EOL
    72             . 
"OR " . $db->like(
"ops_id", 
"text", 
"%:\"" . $this->src_id . 
"\";%") . 
")" . PHP_EOL
    75         $result = $db->query($sql);
    77         while ($row = $db->fetchAssoc($result)) {
    78             $ops = unserialize($row[
"ops_id"]);
    80             if (in_array($this->src_id, $ops) && !in_array($this->dest_id, $ops)) {
    84                     "UPDATE rbac_pa" . PHP_EOL
    85                     . 
"SET ops_id = " . $db->quote(serialize($ops), 
"text") . PHP_EOL
    86                     . 
"WHERE rol_id = " . $db->quote($row[
"rol_id"], 
"integer") . PHP_EOL
    87                     . 
"AND ref_id = " . $db->quote($row[
"ref_id"], 
"integer") . PHP_EOL
    90                 $db->manipulate($sql);
    97             "SELECT rol_id, parent, ops_id" . PHP_EOL
    98             . 
"FROM rbac_templates" . PHP_EOL
    99             . 
"WHERE type = " . $db->quote($this->type, 
"text") . PHP_EOL
   100             . 
"AND (ops_id = " . $db->quote($this->src_id, 
"integer") . PHP_EOL
   101             . 
"OR ops_id = " . $db->quote($this->dest_id, 
"integer") . 
")" . PHP_EOL
   104         $result = $db->query($sql);
   106         while ($row = $db->fetchAssoc($result)) {
   107             $tmp[$row[
"rol_id"]][$row[
"parent"]][] = $row[
"ops_id"];
   110         foreach ($tmp as $role_id => $parents) {
   111             foreach ($parents as $parent_id => $ops_ids) {
   113                 if (
sizeof($ops_ids) < 2 && in_array($this->src_id, $ops_ids)) {
   115                         "rol_id" => [
"integer", $role_id],
   118                         "parent" => [
"integer", $parent_id]
   121                     $db->insert(
"rbac_templates", $values);
 
getPreconditions(Environment $environment)
 
__construct(string $type, int $src_id, int $dest_id)
 
isApplicable(Environment $environment)
 
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g. 
 
achieve(Environment $environment)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
An environment holds resources to be used in the setup process.