19declare(strict_types=1);
29use Psr\Http\Message\ServerRequestInterface;
46 private readonly ServerRequestInterface $http_request,
48 private readonly UIFactory $ui_factory,
49 private readonly \
ILIAS\Data\URI $action_url,
50 private readonly
int $server_id,
51 private readonly
bool $has_write_access
57 array $visible_column_ids,
60 mixed $additional_viewcontrol_data,
62 mixed $additional_parameters
66 yield $row_builder->buildDataRow((
string) $record[
'id'], $record);
70 public function initRecords(): void
72 if ($this->records ===
null) {
74 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_not_ok.svg',
'',
'small'),
75 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_ok.svg',
'',
'small')
80 foreach ($rule_objs as $rule) {
81 switch ($rule->getType()) {
83 $type = $this->
lng->txt(
'ldap_role_by_attribute');
87 $type = $this->
lng->txt(
'ldap_role_by_group');
91 $type = $this->
lng->txt(
'ldap_role_by_plugin');
95 'id' => $rule->getRuleId(),
96 'type' => $type ??
'',
97 'condition' => $rule->conditionToString(),
98 'add' => $icons[(
int) $rule->isAddOnUpdateEnabled()],
99 'remove' => $icons[(
int) $rule->isRemoveOnUpdateEnabled()],
108 $query_params_namespace = [
'ldap',
'role',
'assignment'];
109 $url_builder =
new URLBuilder($this->action_url);
110 [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
111 $query_params_namespace,
116 return $this->ui_factory->table()
119 $this->
lng->txt(
'ldap_tbl_role_ass'),
122 ->withActions($this->getActions($url_builder, $action_parameter_token, $row_id_token))
123 ->withId(
'ldap_role_assignment_table')
124 ->withOrder(
new Order(
'type', Order::DESC))
125 ->withRange(
new Range(0, 100))
126 ->withRequest($this->http_request);
130 mixed $additional_viewcontrol_data,
132 mixed $additional_parameters
134 $this->initRecords();
136 return count((array) $this->records);
151 $this->initRecords();
152 $records = $this->records;
155 $records = $this->orderRecords($records, $order);
159 $records = $this->limitRecords($records,
$range);
174 if ($this->has_write_access) {
175 $actions[
'delete'] = $this->ui_factory->table()->action()->multi(
176 $this->
lng->txt(
'delete'),
177 $url_builder->
withParameter($action_parameter_token,
'confirmDeleteRules'),
182 $actions[
'edit'] = $this->ui_factory->table()->action()->single(
183 $this->has_write_access ? $this->
lng->txt(
'edit') : $this->lng->txt(
'view'),
184 $url_builder->
withParameter($action_parameter_token,
'editRoleAssignment'),
234 [$order_field, $order_direction] = $order->
join(
236 fn($ret, $key, $value) => [$key, $value]
238 usort($records,
static fn(array $left, array $right):
int =>
ilStr::strCmp(
239 $left[$order_field] ??
'',
240 $right[$order_field] ??
''
243 if ($order_direction === Order::DESC) {
244 $records = array_reverse($records);
256 'type' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'ldap_rule_type')),
257 'role' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'ldap_ilias_role')),
258 'condition' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'ldap_rule_condition')),
259 'add' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'ldap_add_roles'))
260 ->withIsSortable(
false),
261 'remove' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'ldap_remove_roles'))
262 ->withIsSortable(
false),
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
join($init, callable $fn)
A simple class to express a naive range of whole positive numbers.
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
__construct(private readonly ServerRequestInterface $http_request, private readonly ilLanguage $lng, private readonly UIFactory $ui_factory, private readonly \ILIAS\Data\URI $action_url, private readonly int $server_id, private readonly bool $has_write_access)
orderRecords(array $records, Order $order)
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
getActions(URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
limitRecords(array $records, Range $range)
getRows(ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e....
getRecords(Range $range, Order $order)
static _getRules($a_server_id)
Get all rules.
static _lookupTitle(int $obj_id)
static strCmp(string $a, string $b)
This describes how an icon could be modified during construction of UI.
A Column describes the form of presentation for a certain aspect of data, i.e.
This describes a Data Table.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.