ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilAccessRBACDeleteDbkSteps.php
Go to the documentation of this file.
1 <?php
17 declare(strict_types=1);
18 
23 {
24  protected \ilDBInterface $db;
25 
26  public function prepare(\ilDBInterface $db) : void
27  {
28  $this->db = $db;
29  }
30 
31  public function step_1() : void
32  {
33  //Delete all entries with type digibook from rbac_ta
34  $sql =
35  "DELETE FROM rbac_ta " .
36  "WHERE typ_id IN (" .
37  "SELECT obj_id FROM object_data " .
38  "WHERE type = 'typ' " .
39  "AND title = 'dbk'" .
40  ")";
41 
42  $this->db->manipulate($sql);
43 
44  //Delete the entry of the digibook type from object_data
45  $sql =
46  "DELETE FROM object_data " .
47  "WHERE type = 'typ' " .
48  "AND title = 'dbk'";
49 
50  $this->db->manipulate($sql);
51  }
52 
53  public function step_2() : void
54  {
55  //Delete every row with the ops_id of the digibook create operation from the rbac tables
56  $sql =
57  "DELETE FROM rbac_ta " .
58  "WHERE ops_id IN (" .
59  "SELECT ops_id FROM rbac_operations " .
60  "WHERE operation = 'create_dbk'" .
61  ")";
62 
63  $this->db->manipulate($sql);
64 
65  $sql =
66  "DELETE FROM rbac_templates " .
67  "WHERE ops_id IN (" .
68  "SELECT ops_id FROM rbac_operations " .
69  "WHERE operation = 'create_dbk'" .
70  ")";
71 
72  $this->db->manipulate($sql);
73 
74  //Delete the operation from rbac_operations
75  $sql =
76  "DELETE FROM rbac_operations " .
77  "WHERE operation = 'create_dbk'";
78 
79  $this->db->manipulate($sql);
80  }
81 
82  public function step_3() : void
83  {
84  //Delete all other rows in the rbac tables which refer to the type dbk
85  $sql =
86  "DELETE FROM rbac_templates " .
87  "WHERE type = 'dbk' "
88  ;
89 
90  $this->db->manipulate($sql);
91  }
92 }
prepare(\ilDBInterface $db)
Prepare the execution of the steps.