ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective Class Reference
+ Inheritance diagram for ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective:
+ Collaboration diagram for ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective:

Public Member Functions

 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Private Member Functions

 getTypesToChange (Environment $environment)
 Get the types of admin nodes where the visible permission needs to be removed. More...
 

Private Attributes

const int RBAC_OP_VISIBLE = 2
 

Detailed Description

Definition at line 31 of file AdminNodesVisibilityRemovedObjective.php.

Member Function Documentation

◆ achieve()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::achieve ( Environment  $environment)

Objectives can be achieved.

They might add resources to the environment when they have been achieved.

This method needs to be idempotent for a given environment. That means: if this is executed a second time, nothing new should happen. Or the other way round: if the environment already looks like desired, the objective should not take any further actions when this is called.

Exceptions

LogicException if there are unfullfilled preconditions.

Exceptions

RuntimeException if there are missing resources.

Implements ILIAS\Setup\Objective.

Definition at line 59 of file AdminNodesVisibilityRemovedObjective.php.

59 : Environment
60 {
61 foreach ($this->getTypesToChange($environment) as $type) {
62 $objective = new ilAccessRBACOperationDeletedObjective($type, self::RBAC_OP_VISIBLE);
63 $objective->achieve($environment);
64 }
65 return $environment;
66 }
getTypesToChange(Environment $environment)
Get the types of admin nodes where the visible permission needs to be removed.

References ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective\getTypesToChange().

+ Here is the call graph for this function:

◆ getHash()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::getHash ( )

Get a hash for this objective.

The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

Definition at line 36 of file AdminNodesVisibilityRemovedObjective.php.

36 : string
37 {
38 return hash("sha256", self::class);
39 }

◆ getLabel()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 41 of file AdminNodesVisibilityRemovedObjective.php.

41 : string
42 {
43 return "Remove visibility permissions from admin nodes";
44 }

◆ getPreconditions()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::getPreconditions ( Environment  $environment)

Objectives might depend on other objectives.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Objective.

Definition at line 51 of file AdminNodesVisibilityRemovedObjective.php.

◆ getTypesToChange()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::getTypesToChange ( Environment  $environment)
private

Get the types of admin nodes where the visible permission needs to be removed.

Returns
string[]

Definition at line 77 of file AdminNodesVisibilityRemovedObjective.php.

77 : array
78 {
79 $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
80 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
81
82 $folder_id = (int) $client_ini->readVariable('system', 'SYSTEM_FOLDER_ID');
83 if (!$folder_id) {
84 return [];
85 }
86
87 // get all types of admin nodes where the visible permission is still defined
88 // exclude the user folder which gets a special treatment in a separate objective
89 // exclude org units to keep the info screen of subunits visible without read access
90 $query = "
91 SELECT d1.`type`
92 FROM tree t
93 JOIN object_reference r ON r.ref_id = t.child
94 JOIN object_data d1 ON d1.obj_id = r.obj_id
95 JOIN object_data d2 ON d2.`type` = 'typ' AND d2.title = d1.`type`
96 JOIN rbac_ta a ON a.typ_id = d2.obj_id AND a.ops_id = %s
97 WHERE t.parent = %s
98 AND d1.`type` <> 'usrf'
99 AND d1.`type` <> 'orgu'
100 ORDER BY d1.`type`
101 ";
102
103 $result = $db->queryF($query, ['integer', 'integer'], [self::RBAC_OP_VISIBLE, $folder_id]);
104
105 $types = [];
106 foreach ($db->fetchAll($result) as $row) {
107 $types[] = (string) $row['type'];
108 }
109 return $types;
110 }

References ILIAS\$db, ILIAS\Setup\Environment\getResource(), ILIAS\Repository\int(), ILIAS\Setup\Environment\RESOURCE_CLIENT_INI, and ILIAS\Setup\Environment\RESOURCE_DATABASE.

Referenced by ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective\achieve(), and ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective\isApplicable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isApplicable()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::isApplicable ( Environment  $environment)

Get to know whether the objective is applicable.

Don't change the environment or cause changes on services in the environment. Just check if this objective needs to be achieved, either currently or at all. In case of doubt whether the objective is applicable or not return true.

Implements ILIAS\Setup\Objective.

Definition at line 68 of file AdminNodesVisibilityRemovedObjective.php.

68 : bool
69 {
70 return !empty($this->getTypesToChange($environment));
71 }

References ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective\getTypesToChange().

+ Here is the call graph for this function:

◆ isNotable()

ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::isNotable ( )

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

Definition at line 46 of file AdminNodesVisibilityRemovedObjective.php.

46 : bool
47 {
48 return true;
49 }

Field Documentation

◆ RBAC_OP_VISIBLE

const int ILIAS\Administration\Setup\AdminNodesVisibilityRemovedObjective::RBAC_OP_VISIBLE = 2
private

Definition at line 34 of file AdminNodesVisibilityRemovedObjective.php.


The documentation for this class was generated from the following file: