19 declare(strict_types=1);
51 $roles_ids = $this->getRolesIdsByViews($standard_views_for_data_collection);
56 $roles_with_no_read_right_on_any_standard_view = array_diff($roles_with_read_acces_ids, $roles_ids);
58 $roles_data = $this->rbac_review->getRolesForIDs($roles_with_no_read_right_on_any_standard_view,
true);
60 if (!empty($roles_data)) {
61 foreach ($roles_data as $role_data) {
62 $role_titles[] = $role_data[
'title'];
71 $rbac_roles = $this->rbac_review->getParentRoleIds($this->ref_id);
72 $roles_with_read_acces_ids = [];
74 foreach ($rbac_roles as $role) {
75 $operations = $this->rbac_review->getActiveOperationsOfRole($this->ref_id, $role[
'rol_id']);
77 if (!empty($operations) && in_array(3, $operations)) {
78 $roles_with_read_acces_ids[] = $role[
'rol_id'];
82 return $roles_with_read_acces_ids;
85 protected function getRolesIdsByViews(array $views_for_data_collection): array
92 foreach ($views_for_data_collection as $view_for_data_collection_array_of_objects) {
93 foreach ($view_for_data_collection_array_of_objects as $view_for_data_collection_object) {
94 $ilDclTableView = ilDclTableView::find($view_for_data_collection_object->getId());
95 $roles_of_view = $ilDclTableView->getRoles();
96 $roles_ids = array_merge($roles_ids, $roles_of_view);
105 $standard_views_for_data_collection = [];
106 foreach ($visible_tables_for_data_collection as $visible_table) {
109 'table_id' => $visible_table[
'id'],
114 return $standard_views_for_data_collection;
119 $visible_tables_for_data_collection = [];
120 $res = $this->database->queryF(
121 "SELECT * FROM il_dcl_table WHERE obj_id = %s AND is_visible = 1",
125 while ($rec = $this->database->fetchAssoc(
$res)) {
126 $visible_tables_for_data_collection[] = $rec;
129 return $visible_tables_for_data_collection;
135 if ($this->
user->getId() == 6) {
142 $roles_ids = $this->getRolesIdsByViews($standard_views_for_data_collection);
144 $user_ids_with_read_right_on_any_standard_view = [];
145 foreach ($roles_ids as $role_id) {
146 $assigned_users = $this->rbac_review->assignedUsers($role_id);
147 if (!empty($assigned_users)) {
148 $user_ids_with_read_right_on_any_standard_view[] = array_merge(
149 $user_ids_with_read_right_on_any_standard_view,
156 if ($this->
in_array_r((
string) $this->
user->getId(), $user_ids_with_read_right_on_any_standard_view)) {
163 protected function in_array_r(
string $needle, array $haystack,
bool $strict =
false): bool
165 foreach ($haystack as $item) {
166 if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && $this->
in_array_r(
ilRbacReview $rbac_review
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()