49 $roles_ids = $this->getRolesIdsByViews($standard_views_for_data_collection);
54 $roles_with_no_read_right_on_any_standard_view = array_diff($roles_with_read_acces_ids, $roles_ids);
56 $roles_data = $this->rbac_review->getRolesForIDs($roles_with_no_read_right_on_any_standard_view,
true);
58 if (!empty($roles_data)) {
59 foreach ($roles_data as $role_data) {
60 $role_titles[] = $role_data[
'title'];
69 $rbac_roles = $this->rbac_review->getParentRoleIds($this->ref_id);
70 $roles_with_read_acces_ids = [];
72 foreach ($rbac_roles as $role) {
73 $operations = $this->rbac_review->getActiveOperationsOfRole($this->ref_id, $role[
'rol_id']);
75 if (!empty($operations) && in_array(3, $operations)) {
76 $roles_with_read_acces_ids[] = $role[
'rol_id'];
80 return $roles_with_read_acces_ids;
83 protected function getRolesIdsByViews(array $views_for_data_collection): array
90 foreach ($views_for_data_collection as
$key => $view_for_data_collection_array_of_objects) {
91 foreach ($view_for_data_collection_array_of_objects as $view_for_data_collection_object) {
92 $ilDclTableView = ilDclTableView::find($view_for_data_collection_object->getId());
93 $roles_of_view = $ilDclTableView->getRoles();
94 $roles_ids = array_merge($roles_ids, $roles_of_view);
103 $standard_views_for_data_collection = [];
104 foreach ($visible_tables_for_data_collection as $visible_table) {
107 'table_id' => $visible_table[
'id'],
112 return $standard_views_for_data_collection;
117 $visible_tables_for_data_collection = [];
118 $res = $this->database->queryF(
119 "SELECT * FROM il_dcl_table WHERE obj_id = %s AND is_visible = 1",
123 while ($rec = $this->database->fetchAssoc(
$res)) {
124 $visible_tables_for_data_collection[] = $rec;
127 return $visible_tables_for_data_collection;
133 if ($this->
user->getId() == 6) {
140 $roles_ids = $this->getRolesIdsByViews($standard_views_for_data_collection);
142 $user_ids_with_read_right_on_any_standard_view = [];
143 foreach ($roles_ids as $role_id) {
144 $assigned_users = $this->rbac_review->assignedUsers($role_id);
145 if (!empty($assigned_users)) {
146 $user_ids_with_read_right_on_any_standard_view[] = array_merge(
147 $user_ids_with_read_right_on_any_standard_view,
154 if ($this->
in_array_r($this->
user->getId(), $user_ids_with_read_right_on_any_standard_view)) {
161 protected function in_array_r(
string $needle, array $haystack,
bool $strict =
false): bool
163 foreach ($haystack as $item) {
164 if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && $this->
in_array_r(
ilRbacReview $rbac_review
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
in_array_r(string $needle, array $haystack, bool $strict=false)
static where($where, $operator=null)
getStandardViewsByVisibleTables(array $visible_tables_for_data_collection)
getAllVisibleTablesForDataColleciton()
getRoleTitlesWithoutReadRightOnAnyStandardView()
__construct(int $obj_id, int $ref_id, ilRbacReview $rbac_review, ilObjUser $user, ilDBInterface $database)
ilDclTableHelper constructor.
hasUserReadAccessOnAnyVisibleTableView()
getRolesIdsWithReadAccessOnDataCollection()