ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 73 of file class.ilAccessRBACStandardOperationsAddedObjective.php.

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

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

◆ getHash()

ilAccessRbacStandardOperationsAddedObjective::getHash ( )

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

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

◆ getLabel()

ilAccessRbacStandardOperationsAddedObjective::getLabel ( )

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

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

◆ getPreconditions()

ilAccessRbacStandardOperationsAddedObjective::getPreconditions ( Environment  $environment)

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

66  : array
67  {
68  return [
70  ];
71  }

◆ isApplicable()

ilAccessRbacStandardOperationsAddedObjective::isApplicable ( Environment  $environment)

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

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

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

◆ isNotable()

ilAccessRbacStandardOperationsAddedObjective::isNotable ( )

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

61  : bool
62  {
63  return true;
64  }

Field Documentation

◆ $type

string ilAccessRbacStandardOperationsAddedObjective::$type
protected

Definition at line 43 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 34 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: