ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAccessRbacStandardOperationsAddedObjective Class Reference
+ Inheritance diagram for ilAccessRbacStandardOperationsAddedObjective:
+ Collaboration diagram for ilAccessRbacStandardOperationsAddedObjective:

Public Member Functions

 __construct (string $type)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Environment $environment)
 
 achieve (Environment $environment)
 
 isApplicable (Environment $environment)
 

Protected Attributes

const RBAC_OP_EDIT_PERMISSIONS = 1
 
const RBAC_OP_VISIBLE = 2
 
const RBAC_OP_READ = 3
 
const RBAC_OP_WRITE = 4
 
const RBAC_OP_DELETE = 6
 
const RBAC_OP_COPY = 99
 
array $valid_operations
 
string $type
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAccessRbacStandardOperationsAddedObjective::__construct ( string  $type)

Member Function Documentation

◆ achieve()

ilAccessRbacStandardOperationsAddedObjective::achieve ( Environment  $environment)

Definition at line 72 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

References ilRbacReview\_getCustomRBACOperationId(), ilObject\_getObjectTypeIdByTitle(), ilRbacReview\_isRBACOperation(), and ILIAS\Setup\Environment\getResource().

72  : Environment
73  {
74  $db = $environment->getResource(Environment::RESOURCE_DATABASE);
75  $type_id = ilObject::_getObjectTypeIdByTitle($this->type, $db);
76 
77  foreach ($this->valid_operations as $ops_id) {
78  if ($ops_id == self::RBAC_OP_COPY) {
79  $ops_id = ilRbacReview::_getCustomRBACOperationId("copy", $db);
80  }
81 
82  if (ilRbacReview::_isRBACOperation($type_id, $ops_id, $db)) {
83  continue;
84  }
85 
86  $values = [
87  "typ_id" => ["integer", $type_id],
88  "ops_id" => ["integer", $ops_id]
89  ];
90 
91  $db->insert("rbac_ta", $values);
92  }
93 
94  return $environment;
95  }
static _getCustomRBACOperationId(string $operation, ?\ilDBInterface $ilDB=null)
static _isRBACOperation(int $type_id, int $ops_id, ?\ilDBInterface $ilDB=null)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
static _getObjectTypeIdByTitle(string $type, ?\ilDBInterface $ilDB=null)
+ Here is the call graph for this function:

◆ getHash()

ilAccessRbacStandardOperationsAddedObjective::getHash ( )

Definition at line 49 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

49  : string
50  {
51  return hash("sha256", self::class . "::" . $this->type);
52  }

◆ getLabel()

ilAccessRbacStandardOperationsAddedObjective::getLabel ( )

Definition at line 54 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

54  : string
55  {
56  $operations = implode(",", $this->valid_operations);
57  return "Add standard rbac operations (type=$this->type;operations=$operations)";
58  }

◆ getPreconditions()

ilAccessRbacStandardOperationsAddedObjective::getPreconditions ( Environment  $environment)

Definition at line 65 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

65  : array
66  {
67  return [
69  ];
70  }

◆ isApplicable()

ilAccessRbacStandardOperationsAddedObjective::isApplicable ( Environment  $environment)

Definition at line 97 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

References ilRbacReview\_getCustomRBACOperationId(), ilObject\_getObjectTypeIdByTitle(), ilRbacReview\_isRBACOperation(), and ILIAS\Setup\Environment\getResource().

97  : bool
98  {
99  $db = $environment->getResource(Environment::RESOURCE_DATABASE);
100  $type_id = ilObject::_getObjectTypeIdByTitle($this->type, $db);
101 
102  foreach ($this->valid_operations as $ops_id) {
103  if ($ops_id == self::RBAC_OP_COPY) {
104  $ops_id = ilRbacReview::_getCustomRBACOperationId("copy", $db);
105  }
106 
107  if (!ilRbacReview::_isRBACOperation($type_id, $ops_id, $db)) {
108  return true;
109  }
110  }
111  return false;
112  }
static _getCustomRBACOperationId(string $operation, ?\ilDBInterface $ilDB=null)
static _isRBACOperation(int $type_id, int $ops_id, ?\ilDBInterface $ilDB=null)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
static _getObjectTypeIdByTitle(string $type, ?\ilDBInterface $ilDB=null)
+ Here is the call graph for this function:

◆ isNotable()

ilAccessRbacStandardOperationsAddedObjective::isNotable ( )

Definition at line 60 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

60  : bool
61  {
62  return true;
63  }

Field Documentation

◆ $type

string ilAccessRbacStandardOperationsAddedObjective::$type
protected

Definition at line 42 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

Referenced by __construct().

◆ $valid_operations

array ilAccessRbacStandardOperationsAddedObjective::$valid_operations
protected
Initial value:
= [
self::RBAC_OP_EDIT_PERMISSIONS,
self::RBAC_OP_VISIBLE,
self::RBAC_OP_READ,
self::RBAC_OP_WRITE,
self::RBAC_OP_DELETE,
self::RBAC_OP_COPY
]

Definition at line 33 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

◆ RBAC_OP_COPY

const ilAccessRbacStandardOperationsAddedObjective::RBAC_OP_COPY = 99
protected

◆ RBAC_OP_DELETE

const ilAccessRbacStandardOperationsAddedObjective::RBAC_OP_DELETE = 6
protected

◆ RBAC_OP_EDIT_PERMISSIONS

const ilAccessRbacStandardOperationsAddedObjective::RBAC_OP_EDIT_PERMISSIONS = 1
protected

◆ RBAC_OP_READ

const ilAccessRbacStandardOperationsAddedObjective::RBAC_OP_READ = 3
protected

◆ RBAC_OP_VISIBLE

const ilAccessRbacStandardOperationsAddedObjective::RBAC_OP_VISIBLE = 2
protected

◆ RBAC_OP_WRITE

const ilAccessRbacStandardOperationsAddedObjective::RBAC_OP_WRITE = 4
protected

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